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

Jason Hellenthal jhell at DataIX.net
Sat Nov 26 05:11:39 UTC 2011



On Fri, Nov 25, 2011 at 10:36:40PM +0100, Christian Kastner wrote:
> Hi,
> 
> On 2011-11-25 08:02, Jason Hellenthal wrote:
> > So with that said... is there a way we could actually make this run @reboot only ?
> 
> Debian's cron[0] and Fedora's cronie[1] have solved this by touching a
> file on first startup and running @reboot only when this file does not
> yet exist.
> 
> Note that while [0] may point to other patches that might be of interest
> to FreeBSD, they are still WIP (as evident from the linked patch) as we
> are still in the process of quiltifying our current code base.
> 

While this sounds like a perfectly sane way to handle the problem at hand this also introduces a need to write some cleanup code to take care of the file semantics. I think comparing daemon start times to the time a system was booted or similiar would alleviate the need for all that. Maybe a flag for @reboot "-s <seconds>" seconds after boottime to allow running @reboot jobs. And set the default to 3600 seconds. At least this would allow adjustment for those startup processes that may take some considerable time before multiuser mode is entered. 

Just some thought.

I really don't think we need to go the route of using files to store information when there is enough information available already via syscall's.

> 
> [0]
> http://anonscm.debian.org/gitweb/?p=pkg-cron/pkg-cron.git;a=blob;f=debian/patches/features/run-on-reboot;h=94bab7dcbc4b34e4686385ca3ba3037453f1f4bb;hb=refs/heads/sf3
> 
> [1]
> http://git.fedorahosted.org/git/?p=cronie.git;a=commitdiff;h=2abb46f60f496e2725333a86ade0f3913981761d
> 
-------------- 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/43d314c7/attachment.pgp


More information about the freebsd-hackers mailing list