Cron notes

From raju

every night

    MAILTO=""
    0 0 * * * $HOME/bin/nightly.py > /dev/null 2>&1
    

The MAILTO line is optional. It disables email from cron jobs (useful when no MTA is installed).

tags | crontab every day

every minute

    * * * * * /bin/date >> $HOME/x/log.txt
    

To run it every minute for the first half an hour

    0-29 * * * * /bin/date >> $HOME/x/log.txt
    

Test run a cron script

Use run_as_cron.sh to test run a cron script in an emulated environment. It requires some initial set up. Check the comments in that script for more details. Basically, we need to dump the cron environment into a file first and then point to it in the script.

See also: Python_code_templates#Test_the_script section in Python_code_templates#Template_3

Useful links