Sunday, March 25, 2018

Small Cron Job Tricks

While troubleshooting a Linux script that fails to run, learned following three tricks about cron job:
  1. Check system log at /var/log/cron to see if the job has been executed on time.
  2. The last cron command in file, say a file in /etc/cron.d, must be followed by an empty line. Otherwise the last cron command will not be executed.
  3. Add  “2>&1” to the end of cron command to disable sending STD to email. By default, root receives email, or address specified by "[email protected]"

No comments: