Cron log?

KenHorse

Member
Mar 18, 2022
60
0
11
69
Where can I find it for the host? I can't seem to locate it in the "usual places" (/var/log).

I'm trying to track down a possible failed cronjob but I don't know if it failed because I can't find a log!
 
I ran : journalctl -u cron and it reports nothing.

I even grep'd the entire /var/log directory for 'cron' and nothing
 
The journal is in binary format, you cant grep for messages there.


Blockbridge : Ultra low latency all-NVME shared storage for Proxmox - https://www.blockbridge.com/proxmox
I get that. As I said, I ran journalctl -u cron and it reported nothing. I also grep'd the entire /var/log directory for cron (recursive) and nothing found either.

So where is the log of cronjobs that have run? I know it ran but don't know why it failed
 
. As I said, I ran journalctl -u cron
This is very unusual, all our nodes have streams of:
Code:
root@pve7demo1:~# journalctl -u cron
Feb 19 11:55:01 pve7demo1 CRON[736099]: pam_unix(cron:session): session opened for user root(uid=0) by (uid=0)
Feb 19 11:55:01 pve7demo1 CRON[736100]: (root) CMD (command -v debian-sa1 > /dev/null && debian-sa1 1 1)
Feb 19 11:55:01 pve7demo1 CRON[736099]: pam_unix(cron:session): session closed for user root
Feb 19 12:05:01 pve7demo1 CRON[739233]: pam_unix(cron:session): session opened for user root(uid=0) by (uid=0)
Feb 19 12:05:01 pve7demo1 CRON[739234]: (root) CMD (command -v debian-sa1 > /dev/null && debian-sa1 1 1)

This is due to a number of system jobs that are in cron by default:
root@pve7demo1:~# ls -al /etc/cron.d
total 36
drwxr-xr-x 2 root root 4096 Feb 22 21:37 .
drwxr-xr-x 117 root root 12288 Feb 22 21:37 ..
-rw-r--r-- 1 root root 201 Jun 7 2021 e2scrub_all
-rw-r--r-- 1 root root 589 Feb 24 2023 mdadm
-rw-r--r-- 1 root root 102 Feb 22 2021 .placeholder
-rw-r--r-- 1 root root 396 Feb 2 2021 sysstat
lrwxrwxrwx 1 root root 20 Aug 3 2021 vzdump -> /etc/pve/vzdump.cron
-rw-r--r-- 1 root root 377 Jul 9 2021 zfsutils-linux
root@pve7demo1:~# ls -alR /etc/cron*
-rw-r--r-- 1 root root 1042 Mar 2 2023 /etc/crontab

/etc/cron.d:
total 36
drwxr-xr-x 2 root root 4096 Feb 22 21:37 .
drwxr-xr-x 117 root root 12288 Feb 22 21:37 ..
-rw-r--r-- 1 root root 201 Jun 7 2021 e2scrub_all
-rw-r--r-- 1 root root 589 Feb 24 2023 mdadm
-rw-r--r-- 1 root root 102 Feb 22 2021 .placeholder
-rw-r--r-- 1 root root 396 Feb 2 2021 sysstat
lrwxrwxrwx 1 root root 20 Aug 3 2021 vzdump -> /etc/pve/vzdump.cron
-rw-r--r-- 1 root root 377 Jul 9 2021 zfsutils-linux

/etc/cron.daily:
total 44
drwxr-xr-x 2 root root 4096 Jan 25 14:57 .
drwxr-xr-x 117 root root 12288 Feb 22 21:37 ..
-rwxr-xr-x 1 root root 1478 May 25 2023 apt-compat
-rwxr-xr-x 1 root root 123 Mar 26 2023 dpkg
-rwxr-xr-x 1 root root 377 Feb 28 2021 logrotate
-rwxr-xr-x 1 root root 1395 Mar 12 2023 man-db
-rwxr-xr-x 1 root root 622 Feb 24 2023 mdadm
-rw-r--r-- 1 root root 102 Feb 22 2021 .placeholder
-rwxr-xr-x 1 root root 518 Feb 2 2021 sysstat

/etc/cron.hourly:
total 20
drwxr-xr-x 2 root root 4096 Jan 3 22:56 .
drwxr-xr-x 117 root root 12288 Feb 22 21:37 ..
-rw-r--r-- 1 root root 102 Feb 22 2021 .placeholder

/etc/cron.monthly:
total 20
drwxr-xr-x 2 root root 4096 Jan 3 22:56 .
drwxr-xr-x 117 root root 12288 Feb 22 21:37 ..
-rw-r--r-- 1 root root 102 Feb 22 2021 .placeholder

/etc/cron.weekly:
total 24
drwxr-xr-x 2 root root 4096 Jan 3 23:00 .
drwxr-xr-x 117 root root 12288 Feb 22 21:37 ..
-rwxr-xr-x 1 root root 1055 Mar 12 2023 man-db
-rw-r--r-- 1 root root 102 Feb 22 2021 .placeholder

/etc/cron.yearly:
total 20
drwxr-xr-x 2 root root 4096 Jan 3 22:56 .
drwxr-xr-x 117 root root 12288 Feb 22 21:37 ..
-rw-r--r-- 1 root root 102 Mar 2 2023 .placeholder

A failed cron job will not log the cause in the log/journal even if you had it working. You will need to troubleshoot the command line or add debug to your script. Do make sure you use absolute paths.

I dont know why you are not seeing any cron info, something unique to your setup. Have you modified it in any way?
What does "systemctl status cron" say?
What version of PVE are you operating on?

Good luck


Blockbridge : Ultra low latency all-NVME shared storage for Proxmox - https://www.blockbridge.com/proxmox
 
This is very unusual, all our nodes have streams of:
Code:
root@pve7demo1:~# journalctl -u cron
Feb 19 11:55:01 pve7demo1 CRON[736099]: pam_unix(cron:session): session opened for user root(uid=0) by (uid=0)
Feb 19 11:55:01 pve7demo1 CRON[736100]: (root) CMD (command -v debian-sa1 > /dev/null && debian-sa1 1 1)
Feb 19 11:55:01 pve7demo1 CRON[736099]: pam_unix(cron:session): session closed for user root
Feb 19 12:05:01 pve7demo1 CRON[739233]: pam_unix(cron:session): session opened for user root(uid=0) by (uid=0)
Feb 19 12:05:01 pve7demo1 CRON[739234]: (root) CMD (command -v debian-sa1 > /dev/null && debian-sa1 1 1)

This is due to a number of system jobs that are in cron by default:
root@pve7demo1:~# ls -al /etc/cron.d
total 36
drwxr-xr-x 2 root root 4096 Feb 22 21:37 .
drwxr-xr-x 117 root root 12288 Feb 22 21:37 ..
-rw-r--r-- 1 root root 201 Jun 7 2021 e2scrub_all
-rw-r--r-- 1 root root 589 Feb 24 2023 mdadm
-rw-r--r-- 1 root root 102 Feb 22 2021 .placeholder
-rw-r--r-- 1 root root 396 Feb 2 2021 sysstat
lrwxrwxrwx 1 root root 20 Aug 3 2021 vzdump -> /etc/pve/vzdump.cron
-rw-r--r-- 1 root root 377 Jul 9 2021 zfsutils-linux
root@pve7demo1:~# ls -alR /etc/cron*
-rw-r--r-- 1 root root 1042 Mar 2 2023 /etc/crontab

/etc/cron.d:
total 36
drwxr-xr-x 2 root root 4096 Feb 22 21:37 .
drwxr-xr-x 117 root root 12288 Feb 22 21:37 ..
-rw-r--r-- 1 root root 201 Jun 7 2021 e2scrub_all
-rw-r--r-- 1 root root 589 Feb 24 2023 mdadm
-rw-r--r-- 1 root root 102 Feb 22 2021 .placeholder
-rw-r--r-- 1 root root 396 Feb 2 2021 sysstat
lrwxrwxrwx 1 root root 20 Aug 3 2021 vzdump -> /etc/pve/vzdump.cron
-rw-r--r-- 1 root root 377 Jul 9 2021 zfsutils-linux

/etc/cron.daily:
total 44
drwxr-xr-x 2 root root 4096 Jan 25 14:57 .
drwxr-xr-x 117 root root 12288 Feb 22 21:37 ..
-rwxr-xr-x 1 root root 1478 May 25 2023 apt-compat
-rwxr-xr-x 1 root root 123 Mar 26 2023 dpkg
-rwxr-xr-x 1 root root 377 Feb 28 2021 logrotate
-rwxr-xr-x 1 root root 1395 Mar 12 2023 man-db
-rwxr-xr-x 1 root root 622 Feb 24 2023 mdadm
-rw-r--r-- 1 root root 102 Feb 22 2021 .placeholder
-rwxr-xr-x 1 root root 518 Feb 2 2021 sysstat

/etc/cron.hourly:
total 20
drwxr-xr-x 2 root root 4096 Jan 3 22:56 .
drwxr-xr-x 117 root root 12288 Feb 22 21:37 ..
-rw-r--r-- 1 root root 102 Feb 22 2021 .placeholder

/etc/cron.monthly:
total 20
drwxr-xr-x 2 root root 4096 Jan 3 22:56 .
drwxr-xr-x 117 root root 12288 Feb 22 21:37 ..
-rw-r--r-- 1 root root 102 Feb 22 2021 .placeholder

/etc/cron.weekly:
total 24
drwxr-xr-x 2 root root 4096 Jan 3 23:00 .
drwxr-xr-x 117 root root 12288 Feb 22 21:37 ..
-rwxr-xr-x 1 root root 1055 Mar 12 2023 man-db
-rw-r--r-- 1 root root 102 Feb 22 2021 .placeholder

/etc/cron.yearly:
total 20
drwxr-xr-x 2 root root 4096 Jan 3 22:56 .
drwxr-xr-x 117 root root 12288 Feb 22 21:37 ..
-rw-r--r-- 1 root root 102 Mar 2 2023 .placeholder

A failed cron job will not log the cause in the log/journal even if you had it working. You will need to troubleshoot the command line or add debug to your script. Do make sure you use absolute paths.

I dont know why you are not seeing any cron info, something unique to your setup. Have you modified it in any way?
What does "systemctl status cron" say?
What version of PVE are you operating on?

Good luck


Blockbridge : Ultra low latency all-NVME shared storage for Proxmox - https://www.blockbridge.com/proxmox
I'm running 8.0.4 at the moment.

systemctl status cron reports nothing

ps aux |grep cron reports

root 887 0.0 0.0 6608 2560 ? Ss Jan28 0:04 /usr/sbin/cron -f

so I know cron is running. But I think I see the problem! My cronjob is set to run Sundays at 0100. Looks like my system clock is off (strange as I run NTP on the host..).

Anyway, looks like the mystery is solved! Sorry to have taken your time
 
Last edited:
systemctl status cron reports nothing

ps aux |grep cron reports
root 887 0.0 0.0 6608 2560 ? Ss Jan28 0:04 /usr/sbin/cron -f
so I know cron is running.
The normal output is :

systemctl status cron
● cron.service - Regular background program processing daemon
Loaded: loaded (/lib/systemd/system/cron.service; enabled; preset: enabled)
Active: active (running) since Sat 2024-02-17 21:06:30 EST; 1 week 1 day ago
Docs: man:cron(8)
Main PID: 1291 (cron)
Tasks: 1 (limit: 154602)
Memory: 1.2M
CPU: 9.546s
CGroup: /system.slice/cron.service
└─1291 /usr/sbin/cron -f

Feb 26 17:25:01 pve7demo1 CRON[4180385]: pam_unix(cron:session): session closed for user root
Feb 26 17:35:01 pve7demo1 CRON[4183750]: pam_unix(cron:session): session opened for user root(uid=0) by (uid=0)
Feb 26 17:35:01 pve7demo1 CRON[4183751]: (root) CMD (command -v debian-sa1 > /dev/null && debian-sa1 1 1)
Feb 26 17:35:01 pve7demo1 CRON[4183750]: pam_unix(cron:session): session closed for user root
Feb 26 17:45:01 pve7demo1 CRON[4187120]: pam_unix(cron:session): session opened for user root(uid=0) by (uid=0)
Feb 26 17:45:01 pve7demo1 CRON[4187121]: (root) CMD (command -v debian-sa1 > /dev/null && debian-sa1 1 1)
Feb 26 17:45:01 pve7demo1 CRON[4187120]: pam_unix(cron:session): session closed for user root
Feb 26 17:55:01 pve7demo1 CRON[4190492]: pam_unix(cron:session): session opened for user root(uid=0) by (uid=0)
Feb 26 17:55:01 pve7demo1 CRON[4190493]: (root) CMD (command -v debian-sa1 > /dev/null && debian-sa1 1 1)
Feb 26 17:55:01 pve7demo1 CRON[4190492]: pam_unix(cron:session): session closed for user root

I dont know whats wrong with your system. Perhaps restart the service, reboot and check the log for any failures
systemctl |grep cron
cron.service loaded active running Regular background program processing daemon


Blockbridge : Ultra low latency all-NVME shared storage for Proxmox - https://www.blockbridge.com/proxmox
 
Last edited:

About

The Proxmox community has been around for many years and offers help and support for Proxmox VE, Proxmox Backup Server, and Proxmox Mail Gateway.
We think our community is one of the best thanks to people like you!

Get your subscription!

The Proxmox team works very hard to make sure you are running the best software and getting stable updates and security enhancements, as well as quick enterprise support. Tens of thousands of happy customers have a Proxmox subscription. Get yours easily in our online shop.

Buy now!