0

I am running Ubuntu 20.04 as a server on a remote machine. I have confirmed that cron is running as a service:


$ sudo service cron status
● cron.service - Regular background program processing daemon
     Loaded: loaded (/lib/systemd/system/cron.service; enabled; vendor preset: enabled)
     Active: active (running) since Mon 2022-05-02 12:17:55 PDT; 4h 45min ago
       Docs: man:cron(8)
   Main PID: 2769 (cron)
      Tasks: 1 (limit: 526)
     Memory: 4.7M
     CGroup: /system.slice/cron.service
             └─2769 /usr/sbin/cron -f

And it has jobs to run under /var/spool/cron/crontabs :

* * * * * /bin/bash -l -c '/tmp/test.sh' >>/tmp/crontest 2>&1

which creates correct output:

$ cat /tmp/crontest 
Mon 02 May 2022 05:02:01 PM PDT
Mon 02 May 2022 05:03:01 PM PDT
Mon 02 May 2022 05:04:01 PM PDT

But is not being logged:

$ cat /etc/rsyslog.d/50-default.conf 
cron.*              /var/log/cron.log
$ ls -lt /var/log/cron.log
-rw-rw---- 1 syslog adm 0 Mar 28  2021 /var/log/cron.log

I have stopped and restarted the service. I have rebooted the server. I changed the group permissions. I tried to change the log directory to /tmp per this question, which did not work, so I am not thinking this is a permissions issue.

I am not sure how to go forward from here. There are lots of people with similar issues, but mostly these seem to be related to misconfigured crontabs. Any help is appreciated.

Edit: Adding the journalctl output. Seems to be working there too.

$ journalctl -xe -u cron.service | tail

May 02 12:17:55 sidero systemd[1]: Started Regular background program processing daemon.
-- Subject: A start job for unit cron.service has finished successfully
-- Defined-By: systemd
-- Support: http://www.ubuntu.com/support
-- 
-- A start job for unit cron.service has finished successfully.
-- 
-- The job identifier is 736.

2
  • What does the systemd-journal tell you? 'journalctl -xe -u cron.service'
    – gerhard d.
    May 3, 2022 at 7:35
  • Added above. Seems to be working. May 5, 2022 at 17:27

0

You must log in to answer this question.

Browse other questions tagged .