cron(8) mis-feature with @reboot long after system startup
jilles at stack.nl
Sat Nov 26 20:33:11 UTC 2011
On Sat, Nov 26, 2011 at 02:58:46PM -0500, APseudoUtopia wrote:
> On Fri, Nov 25, 2011 at 4:36 PM, Christian Kastner <debian at kvr.at> wrote:
> > 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 and Fedora's cronie have solved this by touching a
> > file on first startup and running @reboot only when this file does not
> > yet exist.
> I like this idea, however it has a major caveat: Assuming the shutdown
> scripts remove said file (and the boot scripts create said file), what
> happens in the event that the disk was umount'ed uncleanly? For
> example, a power failure (I know, that's what UPSs are for, but lets
> ignore that for a second). If the system is configured to
> automatically boot after a power failure, the @reboot cron script wont
> run (since the said file still exists...).
The file can be stored in /var/run, which is cleared at boot.
More information about the freebsd-hackers