I went to /var/log/cron
but this file is empty.
How to check if crontab is enabled or is running properly or not in ubuntu
thanks
If you want to know if it's running you can do something like sudo systemctl status cron
or ps aux | grep cron
.
If you want to know if your cron jobs are running, check /var/log/syslog
with the process name cron. For example:
Apr 26 21:17:01 example CRON[18055]: (root) CMD ( cd / && run-parts --report /etc/cron.hourly)
systemctl
attempts will not work in (unprivileged) docker containers. Try the answer from Sean then.
rsyslog
config: open /etc/rsyslog.d/50-default.conf
,remove #
before cron.*
sudo service rsyslog restart
service cron restart
now you can check cron log from file /var/log/cron.log
/etc/rsyslog.conf
if you're on an older system or if there's nothing in /etc/rsyslog.d
May 7, 2019 at 17:32
sudo service cron restart
apart from that your answer worked liked a Charm!!
apt install rsyslog -y
first. Then there was no file in rsyslog.d
as Wimateeka mentioned, but I modified rsyslog.conf
directly.
By default the cron log in Ubuntu is located at /var/log/syslog
. Use the below command to check the cron entries in this file.
grep cron /var/log/syslog
grep -i cron /var/log/syslog
New information for 2020: cron is now a systemctl service, so you can have the logs of cron / anacron with:
journalctl -u cron.service
if you did install anacron, it is the same with:
journalctl -u anacron.service
(anacron is for desktop, when your computer is not garanteed to be always on. It enforce that even if your computer is down at 5'00, daily jobs are run when the computer has started up).