Debugging CRON jobs
- Check that your script appears in /var/log/cron. (note: you may need to do some extra steps to enable cron logging)
- Cron will generate email on ANY stdout or stderr output. Did you receive such email, or did it get ~/.forwarded somewhere?
- This is a quick-n-easy way to emulate the environment that cron runs in.
- This is a more complicated way.
(though it could probably be rewritten to be tailored more to Cron jobs... for instance, logging the output, and not worrying about the STDIN)
dealing with Cron email
Often cron generates too much email. So a lot of admins send everything to /dev/null. (read an accurate and pithy summary of this situation here)
Some attempts to limit the volume of cron email, without hiding errors: