freebsd-nq/usr.sbin/cron/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
..
compat.h
config.h
cron.8 cron(8): Add MAILFROM ability for crontabs 2019-04-15 18:53:28 +00:00
cron.c Add new functionality and syntax to cron(1) to allow to run jobs at a 2018-06-07 22:38:40 +00:00
cron.h Add new functionality and syntax to cron(1) to allow to run jobs at a 2018-06-07 22:38:40 +00:00
crontab Move etc/crontab to usr.sbin/cron/cron/ 2018-09-06 14:55:54 +00:00
database.c cron(8): schedule interval jobs that get loaded during execution 2019-04-20 02:54:20 +00:00
do_command.c cron(8): Add MAILFROM ability for crontabs 2019-04-15 18:53:28 +00:00
externs.h
job.c
Makefile Move etc/crontab to usr.sbin/cron/cron/ 2018-09-06 14:55:54 +00:00
Makefile.depend DIRDEPS_BUILD: Update dependencies. 2017-10-31 00:07:04 +00:00
pathnames.h Remove old, dead compat code. 2018-06-10 02:30:09 +00:00
popen.c
user.c