Tips for Crontab

  1. Add “2>&1 >> cron.log” to redirect stderr and log output. “>>” means appending while “>” means overwriting.
  2. Check the “+x” mode of the script.
  3. Check the relative path in both the script and the cron config. Cron may run in a different directory.
  4. Check the encoding of the script. Cron may run in an environment different from bash.
  5. Check the privileges related with the files used in the script.
Advertisement

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s