How to Log?
I want to know how I can see exactly what the cron jobs are doing on each execution. Where are the log files located? Or can I send the output to my email? I have set the email address to send the log when the cron job runs but I haven't received anything yet.
* * * * * myjob.sh >> /var/log/myjob.log 2>&1
will log all output from the cron job to /var/log/myjob.log
You might use mail
to send emails. Most systems will send unhandled cron
job output by email to root or the corresponding user.
By default cron logs to /var/log/syslog so you can see cron related entries by using:
grep CRON /var/log/syslog
https://askubuntu.com/questions/56683/where-is-the-cron-crontab-log
这是我的代码:
* * * * * your_script_fullpath >> your_log_path 2>&1
链接地址: http://www.djcxy.com/p/25600.html
上一篇: 如何将时间戳添加到STDERR重定向
下一篇: 如何登录?