Implementation steps of opening and viewing Ubuntu cron logs
ubuntu does not enable cron logging by default
**1. Modify rsyslog **
vim /etc/rsyslog.d/50-default.conf
cron.*/var/log/cron.log
**2. Restart rsyslog **
service rsyslog restart
3. View crontab log
tail /var/log/cron.log
By default cron will send an email to send the task's running results such as error messages to the system user's mailbox, instead of the specific script running output information in the log, so we can specify the output log path of each task:
02*** db_backup task;>>/var/log/db_backup.log 2>&1
So we can go to the corresponding log file to view the script output.
If you have any questions, please leave a message or go to the community of this site to discuss, thank you for reading, hope to help you, thank you for your support to this site!
Recommended Posts