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:
$ 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:
$ 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:
$ 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:
$ 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)
🐧 Get the latest tutorials on Linux, Open Source & DevOps via:
- RSS feed or Weekly email newsletter
- Share on Twitter • Facebook • 1 comment... add one ↓
Category | List of Unix and Linux commands |
---|---|
File Management | cat |
Firewall | Alpine Awall • CentOS 8 • OpenSUSE • RHEL 8 • Ubuntu 16.04 • Ubuntu 18.04 • Ubuntu 20.04 |
Network Utilities | dig • host • ip • nmap |
OpenVPN | CentOS 7 • CentOS 8 • Debian 10 • Debian 8/9 • Ubuntu 18.04 • Ubuntu 20.04 |
Package Manager | apk • apt |
Processes Management | bg • chroot • cron • disown • fg • jobs • killall • kill • pidof • pstree • pwdx • time |
Searching | grep • whereis • which |
User Information | groups • id • lastcomm • last • lid/libuser-lid • logname • members • users • whoami • who • w |
WireGuard VPN | Alpine • CentOS 8 • Debian 10 • Firewall • Ubuntu 20.04 |
As someone mentioned in a previous question, how’d you do this in a system.d environment? Can you tail a system.d binary log, not to mention grep?