Debugging CRON jobs

  1. Check that your script appears in /var/log/cron. (note: you may need to do some extra steps to enable cron logging)
  2. Cron will generate email on ANY stdout or stderr output. Did you receive such email, or did it get ~/.forwarded somewhere?
  3. This is a quick-n-easy way to emulate the environment that cron runs in.
  4. This is a more complicated way.

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: