Hello there,
I've just noticed that scripts in /etc/cron.{daily,weekly,...} are not launched for several weeks (I noticed a `locate` not finding a recently added binary). Exactly, it's since June 02, and `# service cron status` says:
Redirecting to /bin/systemctl status crond.service * crond.service - Command Scheduler Loaded: loaded (/usr/lib/systemd/system/crond.service; enabled; vendor preset: enabled) Active: active (running) since Sat 2018-06-02 19:22:57 CEST; 4 weeks 1 days ago Main PID: 1379 (crond) Tasks: 1 Memory: 5.8M CGroup: /system.slice/crond.service `-1379 /usr/sbin/crond -n
Jun 02 19:22:57 ladybug systemd[1]: Started Command Scheduler. Jun 02 19:22:57 ladybug systemd[1]: Starting Command Scheduler... Jun 02 19:22:57 ladybug crond[1379]: (CRON) INFO (RANDOM_DELAY will be scaled with factor 73% if used.) Jun 02 19:22:57 ladybug crond[1379]: (CRON) INFO (running with inotify support) Jun 30 11:22:01 ladybug crond[1379]: (*system*) RELOAD (/etc/crontab) Jun 30 20:06:01 ladybug crond[1379]: (*system*) RELOAD (/etc/crontab) <eof> -----------
So, service is running but what could happen that makes /etc/cron.* not being fired?
/etc/sysconfig/crond hasn't been touched and defines an empty CRONDARGS=.
Stuff in /etc/crontab is running as expected, but it's maybe not related anyway.
Regards,
So, service is running but what could happen that makes /etc/cron.* not being fired?
You don't say, but if this is CentOS 7, then cron.daily/weekly/monthly is run using anacron, not cron.
It's configured in /etc/anacrontab and is usually run once a day by the script /etc/cron.hourly/0anacron - cron.hourly is still run by cron. If the script doesn't exist, then anacron won't run and cron.daily etc won't happen.
P.
Hello Pete,
On Mon, 02 Jul 2018 09:59:17 +0100 Pete Biggs pete@biggs.org.uk wrote:
So, service is running but what could happen that makes /etc/cron.* not being fired?
You don't say, but if this is CentOS 7, then cron.daily/weekly/monthly is run using anacron, not cron.
Oops, yes CentOS 7, sorry.
For the record: # service anacron status Redirecting to /bin/systemctl status anacron.service Unit anacron.service could not be found. You have mail in /var/spool/mail/root
Sure, anacron is not installed. So how could stuff in /etc/cron.{daily,weekly} work until June 02? Probably because it didn't need anacron at all, no? I've looked at yum history, it doesn't talk at all about anacron (but cronie-anacron) so it's not been installed and removed).
It's configured in /etc/anacrontab and is usually run once a day by the script /etc/cron.hourly/0anacron - cron.hourly is still run by cron. If the script doesn't exist, then anacron won't run and cron.daily etc won't happen.
There's a /etc/cron.d/0hourly here: ------------- # Run the hourly jobs SHELL=/bin/bash PATH=/sbin:/bin:/usr/sbin:/usr/bin MAILTO=root 01 * * * * root run-parts /etc/cron.hourly -------------
I'm still not sure that talking about anacron is relevant here, and I don't know why either if you say it should be anacron in CentOS 7.
Regards,
wwp wrote:
On Mon, 02 Jul 2018 09:59:17 +0100 Pete Biggs pete@biggs.org.uk wrote:
So, service is running but what could happen that makes /etc/cron.* not being fired?
You don't say, but if this is CentOS 7, then cron.daily/weekly/monthly is run using anacron, not cron.
Oops, yes CentOS 7, sorry.
For the record: # service anacron status Redirecting to /bin/systemctl status anacron.service Unit anacron.service could not be found. You have mail in /var/spool/mail/root
Sure, anacron is not installed. So how could stuff in /etc/cron.{daily,weekly} work until June 02? Probably because it didn't need anacron at all, no? I've looked at yum history, it doesn't talk at all about anacron (but cronie-anacron) so it's not been installed and removed).
anacron is part of the cronie-anacron package
There is no anacron service file ... anacron is run by cron - see below:
It's configured in /etc/anacrontab and is usually run once a day by the script /etc/cron.hourly/0anacron - cron.hourly is still run by cron. If the script doesn't exist, then anacron won't run and cron.daily etc won't happen.
There's a /etc/cron.d/0hourly here:
# Run the hourly jobs SHELL=/bin/bash PATH=/sbin:/bin:/usr/sbin:/usr/bin MAILTO=root 01 * * * * root run-parts /etc/cron.hourly
I'm still not sure that talking about anacron is relevant here, and I don't know why either if you say it should be anacron in CentOS 7.
grep for anacron in /var/log/cron* for any clues
James Pearson
For the record: # service anacron status Redirecting to /bin/systemctl status anacron.service Unit anacron.service could not be found. You have mail in /var/spool/mail/root
It's not a service. As I said, it's run using a script in /etc/cron.hourly
Sure, anacron is not installed. So how could stuff in /etc/cron.{daily,weekly} work until June 02?
Don't know. But that's how cron.daily is processed and has been since CentOS7 was released. In fact I think CentOS 6 even used anacron. Perhaps you have inadvertently removed an important file like /etc/anacrontab or /etc/cron.hourly/0anacron
Probably because it didn't need anacron at all, no? I've looked at yum history, it doesn't talk at all about anacron (but cronie-anacron) so it's not been installed and removed).
Yes, anacron *is* cronie-anacron
It's configured in /etc/anacrontab and is usually run once a day by the script /etc/cron.hourly/0anacron - cron.hourly is still run by cron. If the script doesn't exist, then anacron won't run and cron.daily etc won't happen.
There's a /etc/cron.d/0hourly here:
# Run the hourly jobs SHELL=/bin/bash PATH=/sbin:/bin:/usr/sbin:/usr/bin MAILTO=root 01 * * * * root run-parts /etc/cron.hourly
OK. So that's the bit of cron config that tells it to run the stuff in cron.hourly - what is in /etc/cron.hourly/ ? If there is no 0anacron file in /etc/cron.hourly/ the cron.daily and cron.weekly will not be processed.
I'm still not sure that talking about anacron is relevant here, and I don't know why either if you say it should be anacron in CentOS 7.
Because that's how cron.daily etc is processed in CentOS 7. I'm not entirely sure why you don't believe me.
P.
Hello Pete,
On Mon, 02 Jul 2018 12:31:55 +0100 Pete Biggs pete@biggs.org.uk wrote:
For the record: # service anacron status Redirecting to /bin/systemctl status anacron.service Unit anacron.service could not be found. You have mail in /var/spool/mail/root
It's not a service. As I said, it's run using a script in /etc/cron.hourly
Got it!
Sure, anacron is not installed. So how could stuff in /etc/cron.{daily,weekly} work until June 02?
Don't know. But that's how cron.daily is processed and has been since CentOS7 was released. In fact I think CentOS 6 even used anacron. Perhaps you have inadvertently removed an important file like /etc/anacrontab or /etc/cron.hourly/0anacron
Probably because it didn't need anacron at all, no? I've looked at yum history, it doesn't talk at all about anacron (but cronie-anacron) so it's not been installed and removed).
Yes, anacron *is* cronie-anacron
It's configured in /etc/anacrontab and is usually run once a day by the script /etc/cron.hourly/0anacron - cron.hourly is still run by cron. If the script doesn't exist, then anacron won't run and cron.daily etc won't happen.
There's a /etc/cron.d/0hourly here:
# Run the hourly jobs SHELL=/bin/bash PATH=/sbin:/bin:/usr/sbin:/usr/bin MAILTO=root 01 * * * * root run-parts /etc/cron.hourly
OK. So that's the bit of cron config that tells it to run the stuff in cron.hourly - what is in /etc/cron.hourly/ ? If there is no 0anacron file in /etc/cron.hourly/ the cron.daily and cron.weekly will not be processed.
I'm still not sure that talking about anacron is relevant here, and I don't know why either if you say it should be anacron in CentOS 7.
Because that's how cron.daily etc is processed in CentOS 7. I'm not entirely sure why you don't believe me.
Can't always believe without proof, I'm afraid (I'm sure you've been answered incorrect/incomplete stuff many times here or elsewhere too). BUT, your answers and James' brought me some light, now I understand how it all works and how anacron is a concept that is not a service, and I thank you all for your help :-), appreciated.
Regards,
Hello James,
On Mon, 2 Jul 2018 11:31:07 +0000 James Pearson james-p@moving-picture.com wrote:
wwp wrote:
On Mon, 02 Jul 2018 09:59:17 +0100 Pete Biggs pete@biggs.org.uk wrote:
So, service is running but what could happen that makes /etc/cron.* not being fired?
You don't say, but if this is CentOS 7, then cron.daily/weekly/monthly is run using anacron, not cron.
Oops, yes CentOS 7, sorry.
For the record: # service anacron status Redirecting to /bin/systemctl status anacron.service Unit anacron.service could not be found. You have mail in /var/spool/mail/root
Sure, anacron is not installed. So how could stuff in /etc/cron.{daily,weekly} work until June 02? Probably because it didn't need anacron at all, no? I've looked at yum history, it doesn't talk at all about anacron (but cronie-anacron) so it's not been installed and removed).
anacron is part of the cronie-anacron package
There is no anacron service file ... anacron is run by cron - see below:
Oh-oh, thanks for your lights.
It's configured in /etc/anacrontab and is usually run once a day by the script /etc/cron.hourly/0anacron - cron.hourly is still run by cron. If the script doesn't exist, then anacron won't run and cron.daily etc won't happen.
There's a /etc/cron.d/0hourly here:
# Run the hourly jobs SHELL=/bin/bash PATH=/sbin:/bin:/usr/sbin:/usr/bin MAILTO=root 01 * * * * root run-parts /etc/cron.hourly
I'm still not sure that talking about anacron is relevant here, and I don't know why either if you say it should be anacron in CentOS 7.
grep for anacron in /var/log/cron* for any clues
Hah!
Log excerpts, something that may matter but that I missed at first: anacron[22814]: Job `cron.daily' locked by another anacron - skipping
Don't know exactly what went wrong there, but I killed a few processes and I'll see how it behaves naturally this night, if it still fails I know have enough to observe, understand and fix. I think you helped me understanding few things here and how to fix it, thanks, James and Pete!
Regards,