I replaced exec cron
with exec cron -L 15
the run sudo service cron reload
, sudo service cron restart
but nothing changed. Cron doesn't log the end of jobs and doesn't log failed jobs. I hade no problem in Ubuntu 14.04, but now I have this problem in Ubuntu 16.04. What do I do wrong?
Step by Step:
First I changed /etc/init/cron.conf:
sudo sed -i 's|exec cron$|exec cron -L15|' /etc/init/cron.conf && sudo restart cron && cat /etc/init/cron.conf
So now it is
$ cat /etc/init/cron.conf
# cron - regular background program processing daemon
#
# cron is a standard UNIX program that runs user-specified programs at
# periodic scheduled times
description "regular background program processing daemon"
start on runlevel [2345]
stop on runlevel [!2345]
expect fork
respawn
exec cron -L 15
I made the same config in my Ubuntu 16.04 as well as on Ubuntu 14.04 on the another PC.
The Cron log in Ubuntu 14.04 is the following:
$ grep CRON /var/log/syslog
Aug 26 16:05:01 y1404 CRON[6825]: (y) CMD (foo # JOB_ID_1)
Aug 26 16:05:01 y1404 CRON[6824]: (CRON) error (grandchild #6825 failed with exit status 127)
So you can see the second line with error notification about nonexistent command foo
. But in Ubuntu 16.04 there is no error notification in the log:
Aug 26 16:25:01 my CRON[7259]: (y) CMD (foo # JOB_ID_129)
Best Answer
From Ubuntu 15.04 on, upstart using
/etc/init/*.conf
is replaced by systemd using configuration files in/lib/systemd/system/
and/etc/systemd/system/
. Although a file/etc/init/cron.conf
is still existent in Ubuntu 16.04, the script normally in use to startcron
now is/lib/systemd/system/cron.service
. If you want to add extra options, edit this file withand replace the line
by e. g.
To reload the configuration, run
sudo systemctl restart cron
or just reboot. You can test what exact command a service was started with usingsystemctl status
, e. g. forcron
(see last line):