I see a lot of pam_unix(cron:session): session opened for user messages. Are any cronjobs running or do you want to see the logs because they are not running?
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
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?
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?
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
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
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.