Ubuntu cron log opening and viewing implementation steps
- 2020-06-15 10:57:31
- OfStack
Ubuntu cron log on and see the implementation steps
ubuntu does not turn on cron logging by default
1. Modify rsyslog
vim /etc/rsyslog.d/50-default.conf
cron.* /var/log/cron.log
# Remove the comment before cron
2. Restart rsyslog
service rsyslog restart
3. Check the crontab log
tail /var/log/cron.log
By default, cron will send an email to the running result of the task, such as error message, to the mailbox of system users, but the specific output information of script running will not appear in log. Therefore, we can specify the output log path of each task under 1:
0 2 * * * db_backup task; >> /var/log/db_backup.log 2>&1
Then we can go to the appropriate log file to see the script output.
If you have any questions, please leave a message or go to this site community exchange discussion, thank you for reading, hope to help you, thank you for your support to this site!