In my Ubuntu VM, I have condigured my cronjob to run a python script every minute just to test

#cat /var/spool/cron/crontabs/*

MAILTO = "myemail@gmail.com"
* * * * * python /home/forge/web-app/database/backup_mysql.py

It been 5 mins now, I don't see any email send to me. I don't see any backup file is being generated.

I have a feeling that this cronjob is never got run.

How do I check it ? How do I fix it ?

Do I need to restart some kind of service ?


I checked pgrep cron I got number printing out.

People suggested to remove the spaces between my =, I did that as suggested


Restart my cron service

sudo service cron restart

Yet, same result. It doesn't seem to trigger still.

Max OS

On the other hand, I have this settings in my Mac OS

MAILTO = "myemail@gmail.com"
0 * * * *       python /Applications/MAMP/htdocs/code/web-app/database/backup_mysql.py

It ran perfecly fine ..

  • 3
    Why did you add spaces between the MAILTO, =, and the address? – thrig Mar 6 '17 at 19:31
  • @thrig is right. Cron accepts valid shell variables and there shouldn't be spaces around the variable assignment and value. – Valentin Bajrami Mar 6 '17 at 19:34
  • Check the /tmp/cron.log file to see if it was created with the expected contents or you can check /var/log/cron file to see what jobs were run. – Katz Mar 6 '17 at 19:36
  • cat: /tmp/cron.log: No such file or directory – cyb3rZ Mar 6 '17 at 19:43
  • @thrig : omg, seriously, is it that picky ? I'll remove it. Do I need to restart my cron service after editing the cron file. – cyb3rZ Mar 6 '17 at 19:45

First of all, the log file that you should check is /var/log/cron , to make sure that the cron is running indeed every minute, as scheduled (if not, you should look into a problem with the functionality of the cron daemon).

If the cron daemon is running fine and you task is indeed running every minute, try to run the script manually from CLI (python /home/forge/web-app/database/backup_mysql.py) and see if is returning any output (if your script is not returning an output message, you will not receive any notifications by e-mail).

Finally, based on how the environment is configured, you might want to run the python script, while providing the full path to the python binary:

root@bbdfbbeb62b0:~# which python

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.