I see so many guides on how to run crontab, but what I need right now is to learn how to
- Find log files about cron jobs
- Configure what gets logged
Answer
Check if the programs you run with cron have their own log files. If if they don't but write their output to the standard outputs you can redirect these to files or mail them to you. Inside crontabs standard shell redirection works.
E.g. to redirect the error output of some_job.sh
to some_job.err
and discarding the standard output (i.e. sending it to /dev/null
) add the following redirection to your crontab
33 3 * * * /path/to/some_job.sh 1> /dev/null 2> /other/path/to/some_job.err
or to mail it to you instead (if mail
is available)
33 3 * * * /path/to/some_job.sh 1> /dev/null 2>&1 | mail -s "cron output" you@example.org
No comments:
Post a Comment