I'm trying to run a python script on my raspberrypi using cron
.
I did the following:
crontab -e # To edit a crontab job
After the cron file opened, I added the following line:
@reboot /usr/bin/python /home/pi/path/to/file/example.py > /home/pi/cronlogs/mylog.log # JOB_ID_!
If I understand the documentation correctly, this cron job should be executed every time after the system booted up. However in my case, when I reboot the computer, the script will not be executed.
What's strange:
- I checked the log file and it's empty, so it seems like everything goes fine
- If I run the given command manually (so basically write the following code to the terminal) it executes and works correctly:
/usr/bin/python /home/pi/path/to/file/example.py > /home/pi/cronlogs/mylog.log
I guess I missed something really obvious but I can't see it. Please can I ask for any advise how to debug this. Thanks!