Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 26 Nov 2011 06:43:38 +0100
From:      "Michael Ross" <gmx@ross.cx>
To:        "Christian Kastner" <debian@kvr.at>, "Jason Hellenthal" <jhell@dataix.net>
Cc:        freebsd-hackers@freebsd.org
Subject:   Re: cron(8) mis-feature with @reboot long after system startup
Message-ID:  <op.v5jgu0rmg7njmm@michael-think>
In-Reply-To: <20111126051121.GA4628@DataIX.net>
References:  <20111125070241.GA7915@DataIX.net> <4ED00A68.4040606@kvr.at> <20111126051121.GA4628@DataIX.net>

next in thread | previous in thread | raw e-mail | index | archive | help
Am 26.11.2011, 06:11 Uhr, schrieb Jason Hellenthal <jhell@dataix.net>:

>
>
> 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.

If system startup were to be unusually delayed (dhcp or nfs trouble eg),  
$time_period might have passed when cron starts, so there would have to be  
some notifying mechanism for @reboot jobs not being run, and operator  
action would be required.

One could "cron restart" within $time_period and run @reboot twice.

I don't like this idea.

In my bikeshed, @reboot should be called @cronstart, but it shouldn't  
because of uniformity across OSs.
The cron manpage should reflect the actual behaviour (already patched in  
svn),
and all "definitely only on boot"-scripts should go in local/etc/rc.d.


Michael



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