Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 25 Nov 2011 10:43:14 +0000
From:      Tom Evans <tevans.uk@googlemail.com>
To:        Jason Hellenthal <jhell@dataix.net>
Cc:        hackers@freebsd.org
Subject:   Re: cron(8) mis-feature with @reboot long after system startup
Message-ID:  <CAFHbX1J4FesrpwHptF7WK2COgDSLEMOyWnpFp1F1xhe_cZ3wiA@mail.gmail.com>
In-Reply-To: <20111125070241.GA7915@DataIX.net>
References:  <20111125070241.GA7915@DataIX.net>

next in thread | previous in thread | raw e-mail | index | archive | help
On Fri, Nov 25, 2011 at 7:02 AM, Jason Hellenthal <jhell@dataix.net> wrote:
>
> List,
>
> When using @reboot with cron you expect your proccesses to always start w=
hen the system boots up and only when the system boots. But long after the =
system in question had been booted, my @reboot processes ran again! after a=
 (/etc/rc.d/cron restart). This is normally fine and dandy until one of you=
r @reboot jobs needs to contain a process that purges files "files that are=
 already in use by a running daemon since the system has not rebooted" and =
becomes hazardous.
>
> So with that said... is there a way we could actually make this run @rebo=
ot only ?
>
> Compare the system boottime (kern.boottime) to the current time and if it=
 is greater than ?5 minutes? do not run on any @reboot's ? or add yet anoth=
er extension @boottime so it does not throw off current functionality ?
>
> Surely I could modify the scripts which do this but I find it unproductiv=
e and counter intuitive for the need to explain that @reboot means "When cr=
on is restarted" even though the name means something completely opposite.
>
>
> Regards & Happy Thanks Giving.
>

Yep, @reboot is super dangerous if you don't realise it is 'crond
reboot' not 'system reboot'. We went through a period where all our
production servers crond kept dieing and getting restarted at odd
times.

The simplest solution is to not run stuff you want to run at boot time
through cron, and instead use rc.d, which is designed to do this.

Cheers

Tom



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?CAFHbX1J4FesrpwHptF7WK2COgDSLEMOyWnpFp1F1xhe_cZ3wiA>