freebsd-dev/usr.sbin/cron
Kyle Evans bd6174f74c cron(8): schedule interval jobs that get loaded during execution
Jobs using the @<second> syntax currently only get executed if they exist
when cron is started. The simplest reproducer of this is:

echo '@20 root echo "Hello!"' >> /etc/cron.d/myjob

myjob will get loaded at the next second==0, but this echo job will not
run until cron restarts. These jobs are normally handled in
run_reboot_jobs(), which sets e->lastexit of INTERVAL jobs to the startup
time so they run 'n' seconds later.

Fix this by special-casing TargetTime > 0 in the database load. Preexisting
jobs will be handled at startup during run_reboot_jobs as normal, but if
we've reloaded a database during runtime we'll hit this case and set
e->lastexit to the current time when we process it. They will then run every
'n' seconds from that point, and a full restart of cron is no longer
required to make these jobs work.

Reported by:	Juraj Lutter (otis_sk.freebsd.org)
Reviewed by:	allanjude, bapt, bjk (earlier version), Juraj Lutter
MFC after:	3 days
Differential Revision:	https://reviews.freebsd.org/D19924
2019-04-20 02:54:20 +00:00
..
cron cron(8): schedule interval jobs that get loaded during execution 2019-04-20 02:54:20 +00:00
crontab cron(8): schedule interval jobs that get loaded during execution 2019-04-20 02:54:20 +00:00
doc
lib Add new functionality and syntax to cron(1) to allow to run jobs at a 2018-06-07 22:38:40 +00:00
Makefile
Makefile.inc Readd Makefile.inc that were used to include upper level Makefile.inc and 2014-11-28 22:03:35 +00:00