3 ms·
Useful things to consider when using Cron: * Do you know where it's going to send any output? If you're not certain then add a MAILTO entry at the start of the
by scrapheap 2y ago
Useful things to consider when using Cron:
* Do you know where it's going to send any output? If you're not certain then add a MAILTO entry at the start of the crontab to make it explicit
* Do your jobs require additional environment variables configuring?
* How noisy is your job's output? Any thing sent to STDOUT or STDERR will get emailed to either the recipients in the MAILTO option or the user that the crontab is for - initially you'll want a lot of output so you can check that it's working as expected, but once you're happy with it then you don't want all the information just any errors. There are many ways to achieve this like using --quiet options on commands to suppress output, or redirecting STDOUT to /dev/null or a file on disk (as errors should end up in STDERR).
- encoderer 2y agoCronitor solves the errors/output collection for you. Made by indie developers, launched here 10 years ago, nice free plan.
- everybodyknows 2y agoIs 'mail' broken in the default Ubuntu desktop install? Cron errors (if not redirecting output to a file) fail to deliver with: Sep 6 02:20:01 ThinkPad-L560 CRON[3748665]: (root) CMD (/bin/bash /root/bin/backup.rsync /.git) Sep 6 02:20:01 ThinkPad-L560 cron[3748668]: sendmail: fatal: open /etc/postfix/main.cf: No such file or directory Sep 6 02:20:01 ThinkPad-L560 postfix/sendmail[3748668]: fatal: open /etc/postfix/main.cf: No such file or directory Sep 6 02:20:01 ThinkPad-L560 CRON[3748664]: (root) MAIL (mailed 291 bytes of output but got status 0x004b from MTA#012) ...