cron(8) mis-feature with @reboot long after system startup

Jason Hellenthal jhell at DataIX.net
Sat Nov 26 19:53:46 UTC 2011



On Fri, Nov 25, 2011 at 12:53:43PM -0500, Dieter BSD wrote:
> The system doesn't go multiuser until the rc jobs complete,
> even if you attempt to background them with '&'. ??This can be
> a problem with long running jobs. ??I started using cron @reboot
> for this reason.
> 
> I haven't run into the problem since I've never needed to run
> /etc/rc.d/cron restart.

Yeah I have never ran into this either throughout all my use cases. cron(8) has always ran and stayed running until my OP where I found out the hardway. Would make someone proud to be called Paul Vixie. ;)

> 
> > Add an option to cron to check lastlog and if within 5 or 10 minutes
> > of the last reboot, then call run_reboot_jobs().
> 
> Depending on timestamps might be okay as a temporary quick-and-dirty
> workaround, but there is likely to be a case where it will also do the
> wrong thing. ??What if you need to restart cron within the 5-10 minutes?
> 
> Maybe something like: rc script sets a flag, cron_reboot script checks
> and resets flag. ??The flag could be a file ("> /tmp/rebooting_system").
> Better yet, a run-the-reboot-script command line option could be added
> to cron.

cron(8) already creates a pid file. Maybe it wouldn't be so bad to just check the timestamp of that before creating its new pid file along with comparing to system boottime so we could make an accurate measure whether it should or should not run the @reboot extension at least down to 1 minute.

> _______________________________________________
> freebsd-hackers at freebsd.org mailing list
> http://lists.freebsd.org/mailman/listinfo/freebsd-hackers
> To unsubscribe, send any mail to "freebsd-hackers-unsubscribe at freebsd.org"
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 455 bytes
Desc: not available
Url : http://lists.freebsd.org/pipermail/freebsd-hackers/attachments/20111126/68e615f0/attachment.pgp


More information about the freebsd-hackers mailing list