Here is the simplest way to do it:
--> Make a change in
/etc/rsyslog.d/50-default.conf with your favorite editor:
sudo gedit /etc/rsyslog.d/50-default.conf
Use Ctrl-f (find) and type
cron to find the line that says
# from that line. Then restart the service:
service rsyslog restart
From then on, all cron-related output will go to
In order to prevent
cron from sending summary emails, place this line at the beginning of your
(Insert first line)
Then to watch it in near-real-time, first create a
echo "#!/bin/bash" >wcron
echo "watch -n 10 tail -n 25 /var/log/cron.log" >>wcron
chmod +x wcron
sudo cp wcron /usr/sbin
- watch -n 10 tells it to refresh the page every 10 seconds
- tail -n 25 tells it to display the last 25 entries
Whenever you want to monitor
cron in near-real-time in a terminal window, enter:
This is handy to have open in one of the 4 virtual desktops, perhaps along with System Monitor.
If you want to see more than just the launch times of longer jobs, it is easy to make the cron.log show both script start times and script end times, along with non-zero exit status messages.
How to change cron log level?
From Ubuntu 15.04 on, upstart using
/etc/init/*.conf is replaced
by systemd using configuration files in
/etc/systemd/system/. Although a file
/etc/init/cron.conf is still
existent in Ubuntu 16.04, the script normally in use to start
To add the
-L 15 option, open the editor by using:
sudo systemctl edit --full cron
OR I RECOMMEND:
sudo gedit /lib/systemd/system/cron.service
and replace the line
ExecStart=/usr/sbin/cron -f $EXTRA_OPTS
ExecStart=/usr/sbin/cron -L 15 -f $EXTRA_OPTS
Then reload the configuration:
sudo systemctl restart cron
It will load it on boot also.
wcron to show all the information you need to watch your cron system as it runs your scripts on schedule.
One final idea for monitoring
cron is to teach your scripts to speak.
16.04 LTS How to make the system announce the time at the top of the hour with eSpeak
I have many of my scripts announce when they start and when they stop, or if they encounter errors.
Volume may be adjusted in the
espeak command so they can be subtle.