am trying to find errors or message for my cron job on Ubuntu Linux server. Where is the cron log in Ubuntu Linux 12.04/14.04 LTS server? How do I check cron logs in Ubuntu server? How to check if crond server is enabled and/or is running properly on Ubuntu Linux server?
You can use the following command to check crond and cron logs.
Sample outputs:
You can use the following command to check crond and cron logs.
Is crond (cron server) running?
Use the pgrep or ps command as follows to verify that crond is running:
pgrep cron ps aux | grep cron sudo service cron status sudo status cron
Sample outputs:
You can check /var/log/syslog file to find out if cron service running or not using the
grep command as follows:
You can check /var/log/syslog file to find out if cron service running or not using the
grep command as follows:
$ sudo grep --color -i cron /var/log/syslog
Sample outputs:
Jan 17 17:43:21 planetvenus cron[229]: (CRON) INFO (pidfile fd = 3) Jan 17 17:43:21 planetvenus cron[240]: (CRON) STARTUP (fork ok) Jan 17 17:43:21 planetvenus cron[240]: (CRON) INFO (Running @reboot jobs) Jan 17 18:01:01 planetvenus cron[240]: (*system*cache) NOT A REGULAR FILE (/etc/cron.d/cache) Jan 17 18:01:01 planetvenus cron[240]: (*system*output) NOT A REGULAR FILE (/etc/cron.d/output) Jan 17 18:11:45 planetvenus root: cronplanet Jan 17 18:12:11 planetvenus root: cronplanet Jan 17 18:17:01 planetvenus CRON[3911]: (root) CMD ( cd / && run-parts --report /etc/cron.hourly) Jan 17 18:23:31 planetvenus cron[3927]: (CRON) INFO (pidfile fd = 3)
Where are cron logs stored on Ubuntu Linux?
The logs are stored in /var/log/cron.log file. You need to configured it as follows. Edit /etc/rsyslog.d/50-default.conf file using a text editor such as vi or nano:
OR
Find the line:
$ sudo vi /etc/rsyslog.d/50-default.conf
OR
$ sudo nano /etc/rsyslog.d/50-default.conf
Find the line:
#cron.* /var/log/cron.log
Uncoment the line (i.e. remove #):
cron.* /var/log/cron.log
Restart the following two services:
Sample outputs:
$ sudo service rsyslog restart
$ sudo service cron restart
Sample outputs:
rsyslog stop/waiting rsyslog start/running, process 4004 cron stop/waiting cron start/running, process 4014
Now, where are cron errors logged in Ubuntu LTS server?
You need to view /var/log/cron.log file using the grep or tail command:
Sample outputs from my log file:
$ sudo grep something /var/log/cron.log
$ sudo more /var/log/cron.log
$ sudo tail -f /var/log/cron.log
$ sudo egrep -i 'error|log' /var/log/cron.log
$ sudo tail -F /var/log/cron.log
Sample outputs from my log file:
Jan 17 18:29:27 planetvenus cron[3988]: (CRON) INFO (Skipping @reboot jobs -- not system startup) Jan 17 18:34:25 planetvenus cron[4013]: (CRON) INFO (pidfile fd = 3) Jan 17 18:34:25 planetvenus cron[4014]: (CRON) STARTUP (fork ok) Jan 17 18:34:25 planetvenus cron[4014]: (CRON) INFO (Skipping @reboot jobs -- not system startup) Jan 17 18:45:01 planetvenus CRON[4039]: (root) CMD (/root/scripts/mk.rss.feed) Jan 17 18:45:02 planetvenus CRON[4038]: (CRON) info (No MTA installed, discarding output) Jan 17 18:50:01 planetvenus CRON[4051]: (root) CMD (/root/scripts/mk.rss.feed) Jan 17 18:50:03 planetvenus CRON[4050]: (CRON) info (No MTA installed, discarding output) Jan 17 18:55:01 planetvenus CRON[4060]: (root) CMD (/root/scripts/mk.rss.feed) Jan 17 18:55:02 planetvenus CRON[4059]: (CRON) info (No MTA installed, discarding output)
No comments :
Post a Comment