Skip to content Skip to sidebar Skip to footer

Cron Task Python Script Not Working

I have a python script I want to fire off every night at midnight. I'm using cron scheduler right now to do so, however, I can't figure out why it's not working. For now, I've been

Solution 1:

From your current crontab file, you're basically running root /home/grantmcgovern/Developer/Projects/StudyBug/Main.py every time.

If you want to run it as root, use sudo crontab -e and put 43 14 * * * /usr/bin/python /home/grantmcgovern/Developer/Projects/StudyBug/Main.py instead.

Solution 2:

I think it is looking for the command "root" so the syntax is wrong, so it should be this...

43 14 * * * /home/grantmcgovern/Developer/Projects/StudyBug/Main.py

If you need it to run as root then I think you can use su like this:

43 14 * * * su root -c "/home/grantmcgovern/Developer/Projects/StudyBug/Main.py"

If you add it to the system crontab then I think it will anyway.

Post a Comment for "Cron Task Python Script Not Working"