Is there anything actually including /etc/cron.daily or /etc/cron.weekly on the new system? I doubt Webmin tries to “know” about every possible cron directory, I assume it checks the /etc/crontab or /etc/cron.d/* files, and whatever it included by those would also get parsed and listed. (That’s a guess, it’s been a long time since I’ve looked at the cron module code.)
To be clear, when I look at one of my systems, I have this in /etc/cron.d:
[root@n1 etc]# ls cron.d
0hourly raid-check
[root@n1 etc]# cat cron.d/0hourly
# Run the hourly jobs
SHELL=/bin/bash
PATH=/sbin:/bin:/usr/sbin:/usr/bin
MAILTO=root
01 * * * * root run-parts /etc/cron.hourly
Note there is nothing that would include cron.daily or cron.weekly on my system, so Webmin shouldn’t show those directories, as they are not active cron jobs (even though some files exist in /etc/cron.daily, there is nothing configured to use them, AFAIK).
The screenshot above is from the Debian 12 system I just installed. Looks to an amateur like me as plenty of jobs. I was just clicking around and comparing the webmin’s on the old and new install and noticing the difference.
The existence of files in those directories does not determine whether those jobs actually will be run by cron.
When I look at one of my RHEL systems, I see what I showed above. Only cron.hourly is enabled. cron.daily has files, but nothing ever loads them. And, Webmin, rightly, ignores it.
Is there anything in crontab or cron.d that actually loads files (probably using run-parts) in cron.daily or cron.weekly?
Is there anything in crontab or cron.d that actually loads files (probably using run-parts) in cron.daily or cron.weekly?
I think so:
root@green12 ~ # cat /etc/crontab
# /etc/crontab: system-wide crontab
# Unlike any other crontab you don't have to run the `crontab'
# command to install the new version when you edit this file
# and files in /etc/cron.d. These files also have username fields,
# that none of the other crontabs do.
SHELL=/bin/sh
PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
# Example of job definition:
# .---------------- minute (0 - 59)
# | .------------- hour (0 - 23)
# | | .---------- day of month (1 - 31)
# | | | .------- month (1 - 12) OR jan,feb,mar,apr ...
# | | | | .---- day of week (0 - 6) (Sunday=0 or 7) OR sun,mon,tue,wed,thu,fri,sat
# | | | | |
# * * * * * user-name command to be executed
17 * * * * root cd / && run-parts --report /etc/cron.hourly
25 6 * * * root test -x /usr/sbin/anacron || { cd / && run-parts --report /etc/cron.daily; }
47 6 * * 7 root test -x /usr/sbin/anacron || { cd / && run-parts --report /etc/cron.weekly; }
52 6 1 * * root test -x /usr/sbin/anacron || { cd / && run-parts --report /etc/cron.monthly; }
#
Checked and the daily jobs run fine. Added a test one that sends an email to myself. It works but just does not show up on the scheduled cron jobs page.
Good news: My daily jobs run fine
Bad news: They are not showning up in webmin
Think I found the cause. The definition of crontab changed a tiny bit between Debian 11 and 12 and the regular expression to find run-parts fails.
Debian 11 crontab
17 * * * * root cd / && run-parts --report /etc/cron.hourly
25 6 * * * root test -x /usr/sbin/anacron || ( cd / && run-parts --report /etc/cron.daily )
47 6 * * 7 root test -x /usr/sbin/anacron || ( cd / && run-parts --report /etc/cron.weekly )
52 6 1 * * root test -x /usr/sbin/anacron || ( cd / && run-parts --report /etc/cron.monthly )
Debian 12 crontab
17 * * * * root cd / && run-parts --report /etc/cron.hourly
25 6 * * * root test -x /usr/sbin/anacron || { cd / && run-parts --report /etc/cron.daily; }
47 6 * * 7 root test -x /usr/sbin/anacron || { cd / && run-parts --report /etc/cron.weekly; }
52 6 1 * * root test -x /usr/sbin/anacron || { cd / && run-parts --report /etc/cron.monthly; }
Note {} instead of () on the anacron lines.
In the regular expression in cron_lib.pl expects () instead of {}
sub is_run_parts
{
local ($cmd) = @_;
local $rp = $config{'run_parts'};
$cmd =~ s/\s*#.*$//;
return $rp && $cmd =~ /$rp(.*)\s+(\-\-\S+\s+)*([a-z0-9\.\-\/_]+)(\s*\))?$/i ? $3 : undef;
}
Yep, that seems like a bug. (Or, more just a change in how the OS package is doing things that Webmin doesn’t handle. It used to work because the way things were done was different.)