Run at reboot/resume if missed
I have a job:
&bootrun 0 5 * * * /usr/sbin/logwatch --output mail
My understanding is that this job will run at 5 minutes after midnight every day, and at reboot/resume if missed:
bootrun Run an &-line at fcron's startup (or system's resume after suspend/hibernation) if it should have run during system down time
In fact the job runs as expected, except that it runs a second time at reboot, so clearly I don't understand bootrun correctly.
Log:
{resumed from suspend)
Jul 24 08:14:01 acer fcron[2365]: suspend/hibernate detected: we woke up after 42108s instead of 900s. The system was suspended for 41626s.
...
Jul 24 08:14:07 acer fcron[23580]: Job '/usr/sbin/logwatch --output mail' started for user systab (pid 23582)
Jul 24 08:14:12 acer fcron[23580]: Job '/usr/sbin/logwatch --output mail' completed
(rebooted nothing logged)
Jul 24 08:19:40 acer fcron[5068]: Job '/usr/sbin/logwatch --output mail' started for user systab (pid 5070)
Jul 24 08:19:46 acer fcron[5068]: Job '/usr/sbin/logwatch --output mail' completed
Perhaps bootrun man should read:
bootrun Run an &-line at fcron's startup, or system's resume after suspend/hibernation if it should have run during system down time.
?
I wonder if fcron had a chance to save the state when you rebooted. If it didn't, then it wouldn't know that the job was already run so it would run it (again).
Do you see a line like:
2024-08-22T17:34:31.113829+01:00 <cron.debug> fcron[84153]: Saving systab...
right before the reboot?
If not:
- what OS/distribution do you run
- how did you install fcron
- how did you reboot, e.g. did you do a 'clean' reboot (where daemons stop cleanly), or a hard reset?
I wonder if fcron had a chance to save the state when you rebooted. If it didn't, then it wouldn't know that the job was already run so it would run it (again).
Right, so my settings/understanding are not wrong. I cannot remember a line like that in the log, so that may be the problem, I will need to do some checks to see.
For the record:
- Artix (Arch) 6.10.6 with Openbox 3.6.1-11
- from Artix World Repo 3.3.1
- will check
Thank you for your help
Logically I think your assumption is correct. 'Clean' reboot did not show duplicate cron jobs. But: I cannot find any messages similar to the one you showed, anywhere. Where should I expect to find it? I looked in crond.log and also ran a grep -r as root, in the logs folder /var/log.
Those are DEBUG log-level messages. To see them, you need to:
- run the fcron daemon in debug mode, with the command line argument
--debug - configure your (r)syslog to capture debug lines, e.g.:
$ cat > /etc/rsyslog.d/10-fcron.conf <<_EOF
$template precise,"%timegenerated:::date-rfc3339% <%PRI-text%> %syslogtag% %msg%\n"
cron.* /var/log/cron.log;precise
_EOF