Closed AxelG-DE closed 8 months ago
I do not see any reason for that. Could that be some change in the gentoo packages not in the upstream sources?
Currently I cannot tell, that there is something different in Gentoo. Cronie depends on sys-process/cronbase, which hasn't been updated since September 10th 2023. So the gentoo-guys potentially say the same just vice versa :)
To me it looks like the anacron function is not working anymore.
The only thing I could actually dig out is /etc/cron.hourly/0anacron has changed:
previous version (from my backup):
#!/bin/sh
# Check whether 0anacron was run today already
if test -r /var/spool/anacron/cron.daily; then
day=`cat /var/spool/anacron/cron.daily`
fi
if [ `date +%Y%m%d` = "$day" ]; then
exit 0
fi
# Do not run jobs when on battery power
online=1
for psupply in /sys/class/power_supply/* ; do
if [ `cat "$psupply/type" 2>/dev/null`x = Mainsx ] && [ -f "$psupply/online" ]; then
if [ `cat "$psupply/online" 2>/dev/null`x = 1x ]; then
online=1
break
else
online=0
fi
fi
done
if [ $online = 0 ]; then
exit 0
fi
/usr/sbin/anacron -s
current version:
#!/bin/sh
# Check whether 0anacron was run today already
if test -r /var/spool/anacron/cron.daily; then
day=`cat /var/spool/anacron/cron.daily`
fi
if [ `date +%Y%m%d` = "$day" ]; then
exit 0
fi
# Check whether run on battery should be allowed
if test -r /etc/default/anacron; then
. /etc/default/anacron
fi
if [ "$ANACRON_RUN_ON_BATTERY_POWER" != "yes" ]; then
# Do not run jobs when on battery power
online=1
for psupply in /sys/class/power_supply/* ; do
if [ `cat "$psupply/type" 2>/dev/null`x = Mainsx ] && [ -f "$psupply/online" ]; then
if [ `cat "$psupply/online" 2>/dev/null`x = 1x ]; then
online=1
break
else
online=0
fi
fi
done
if [ $online = 0 ]; then
exit 0
fi
fi
/usr/sbin/anacron -s
I am not a pro for shell script but I cannot see anything super weird. On my system there is no /etc/default/anacron
maybe the line
if [ "$ANACRON_RUN_ON_BATTERY_POWER" != "yes" ]; then
triggers the problem because the variable $ANACRON_RUN_ON_BATTERY_POWER isn't defined in this script...
and again not a script-pro, but 1= "yes" means not-on-battery, which I wonder is what is really really intended...
BTW: I have asked on IRC libera.chat #gentoo but I didn't get any reply on this typically very busy and competent channel
BTW: /etc/cron.daily works well, fwiw
Addition of this ANACRON_RUN_ON_BATTERY_POWER check was done before 1.7.0 though.
Try running the 0anacron or even edit it to add set -x to see what is actually evaluated/executed.
Addition of this ANACRON_RUN_ON_BATTERY_POWER check was done before 1.7.0 though.
you are right, I see on my backup on Jan17th, that this file 0anacron already looks like today and my weekly backup ran last time successfully on Jan 20th
Try running the 0anacron or even edit it to add set -x to see what is actually evaluated/executed.
with set -x
sh 0anacron
+ test -r /var/spool/anacron/cron.daily
++ cat /var/spool/anacron/cron.daily
+ day=20240206
++ date +%Y%m%d
+ '[' 20240206 = 20240206 ']'
+ exit 0
interestingly /var/spool/anacron/cron.weekly says: 20240202 but I do not have the "reaction" of rsnapshot of that day
/etc/anacrontab got touched on Jan 20th but diff shows, it is the same than in the past
As as also edited in the main issue, I filed a downstream bug: https://bugs.gentoo.org/923953
I will correct the link to downstream bug as soon as I'm back home
Done. Likely actually a gentoo issue acc to the gentoo bug tracking, but donno yet
I don't know what could've caused this on our end. We've had no other reports of it and the only difference between those cronie versions downstream was backporting the patches which landed upstream. No packaging changes otherwise.
I like the Avatar and the Nick :-)
back to the topic
I am afraid, that all this issue is maybe due to wrong expectations based on my experience with vixie-cron. If that is the case, my apologies for the noise and I hope I did not lose all reputation for bug-reporting :)
I do understand, that cronie is partially working differently. However, from time to time I do invoke /etc/cron.daily or .weekly by hand.
Unfortunately I didn't find a good (and official cronie-) documentation, which explains clear and simple, how the mechanism works (whereas vixie-cron with its crontab entries was self explanatory). One has to read thru different man pages. Maybe default in Linux but here a bit challenging, when you are not well into it...
I will unmask cronie-1.7.1-r1 and will observe it with my likely re-adjusted knowledge
This is what anacron does. Of course it would be possible to run the daily/weekly jobs at a fixed time/date if anacron was not used to run them.
please allow me to hold this issue open until next pass thru of cron.weekly and cron.monthly. I will close by then, if everything works as described here lately.
- what is the duration of cron.monthly, means how many days since last cron.monthly it will be re-run?
It depends on how many days this and the previous month had. So its at most 31days but can be 30, 28 or 29 (for February in leap years).
thank you everybody for patience....
this issue was false alarm, my apologies!!!
What happened:
After upgrading sys-process/cronie from 1.7.0-r2 to 1.7.1-r1 (gentoo), cronie does not invoke any of my scripts or commands in /etc/cron.weekly (see Edit_4 for .weekly) or cron.monthly. This worked fine since the year 2019....
EDIT_1:
ls -l | grep cron.
Edit_2 I have read this https://forums.gentoo.org/viewtopic-t-1108098-start-0.html and cannot find anything weird
Edit_3 I filed a downstream bug https://bugs.gentoo.org/923953
Edit_4 I kept analysing further:
my appologies, I was too much relying on /var/log/rsnapshot (where I saw the issue first, as I observe my backup since recently my server's HDDs died and got replaced)
so updated ground-truth: cron.weekly got invoked on Feb 2nd (partially) successfully there was an error, but I cannot nail it down. It said:
cron.weekly got invoked or triggerd on Feb 4th, but didn't run well:
why I say "didn't run well"? Because usually it says "Job `cron.weekly' started" or terminated, but not on the 4th (Sunday), where a normal cronjob should have run, if I am not mistaken
I studied a lot in the internet about anacrontab and cronie, but I still do not know, which day of the month, a monthly job should run if the machine is up and running