I am attempting to run a scheduled .py file every 5 minutes with crontab but I don't think it's working.
I'm following this post with the instructions: Can't run python script from cron
I opened up terminal and ran
crontab -e, adding in:
5 * * * * /usr/bin/python /home/pi/Desktop/BacTest/test3.py
to the crontab file.
I then saved the crontab with Ctrl-X, then Y, then ENTER.
Nothing appears to happen, even after a reboot... There is a SQLite database file that the test3.py file is supposed to update, but I don't see the updates happening. At least when I right click on the .py file and .db to view the properties there isn't any change to the last access/modification/permission change, or size of the SQLite .db file. However, if I open up terminal in the
/home/pi/Desktop/BacTest and run the
test3.py file it all works fine...
Any tips are greatly appreciated!
This is the test3.py file where I am using a python package called BAC0 to access a building automation system. Its really pretty simple where I can retrieve 2 data points (gas usage & outdoor temp) from the hot water system and save to SQLite on pi. BAC0 has a
.save() that defaults to SQLite. In terminal on pi when I run the test3.py file it works just fine...
import BAC0 import pandas as pd bacnet = BAC0.connect(ip='10.30.4.104/16') hws = BAC0.device('100:99', 30099, bacnet, poll=0) hws['THERM'].poll() hws['OA-T'].poll() print(hws['OA-T'], hws['THERM']) hws.save()