The manpage of cron says
When executing commands, any output is mailed to the owner of the crontab (or to the user specified in the MAILTO environment variable in the crontab, if such exists). Any job output can also be sent to syslog by using the -s option.
I am trying to understand why the cron daemon makes efforts about recording output when executing a cron job. It looks to me that using redirection in the job will also work?
Does "any output" include both
- the output generated by the job executed by cron daemon
- and the output generated the cron daemon itself?
"any output" is only the output generated by the job executed by cron daemon and not the output generated by the cron daemon itself, and
we only care the content of the output, not which file the output will be written to,
can we just specify in the job line in cronab file to redirect the output of the command(s) in the job into any file, instead of using cron's loggin/email features (e.g. option
-s and the likes)?
30 18 * * * rm /home/someuser/tmp/* > /home/t/mycron.log 2>&1