Schedule a cron job (a Python script) every 2 minutes

Have some feedback, questions, suggestions, or just fancy a chat? Pop it in here.
Post Reply
ripplingwater
Posts: 8
Joined: Sat Mar 31, 2018 4:38 pm

Schedule a cron job (a Python script) every 2 minutes

Post by ripplingwater »

hi,

I have just started using DietPi and find it really cool. I had couple of minor hiccups as I got familiar but everything works great now. Need a small help because I couldn't get this to work - I need to schedule a Python script to run every 2 minutes ( on a Raspberry Pi Zero W, running DietPi 6.7 ). Here's what I did

I added a cron job by issuing the command "sudo crontab -e" and then included this line towards the bottom of the file

Code: Select all

*/2 * * * * python /opt/scripts/post-updates.py
I also tried adding the shebang line to my Python script and then removed "Python" from the above line but it still doesn't seem to work

Code: Select all

*/2 * * * * /opt/scripts/post-updates.py
But the above script doesn't seem to run. And also if I include any print statements in Python script, would it print onto my ssh console when the job runs? Thanks & Cheers
Post Reply