Implementation steps of opening and viewing Ubuntu cron logs

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 

Remove the comment in front of cron

**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

Implementation steps of opening and viewing Ubuntu cron logs
Ubuntu change password and username steps
Coexistence of CUDA8.0 and CUDA9.0 under Ubuntu 16.04
ubuntu Docker installation and deployment of Rancher
Python implementation of intersection and IOU tutorial
Installation and uninstallation of CUDA under Ubuntu 16.04
Installation and deployment of Nginx in Ubuntu
The implementation of the Ubuntu18.04 installation Pycharm tutorial
Installation and use of Win10 subsystem Ubuntu
Summary of Ubuntu system and privacy cleaning tools
Installation of pulseaudio and API usage under Ubuntu 12.04
The basic configuration and interface beautification of Ubuntu
Installation, configuration and uninstallation of GitLab in Ubuntu19.1
Installation and use of SSH in Ubuntu environment