From owner-freebsd-hackers@FreeBSD.ORG Fri Nov 25 17:02:36 2011 Return-Path: Delivered-To: hackers@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id F00101065670 for ; Fri, 25 Nov 2011 17:02:36 +0000 (UTC) (envelope-from fjwcash@gmail.com) Received: from mail-vw0-f54.google.com (mail-vw0-f54.google.com [209.85.212.54]) by mx1.freebsd.org (Postfix) with ESMTP id A53598FC0A for ; Fri, 25 Nov 2011 17:02:36 +0000 (UTC) Received: by vbbfa15 with SMTP id fa15so4791057vbb.13 for ; Fri, 25 Nov 2011 09:02:35 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; bh=sTonm8G8rL4CdHSItwnr7POAZO91n8s5Vb6i733tJxk=; b=o7gQuLL14HKTG9TDcPdqEW59ea4cPMP3+ICLc0xQXo6uk1Kb9Jc2T2Zf0q2nnIpB0M FswsvQ3U1hmpgQ/uI5an828o8yhLktOlFoVCplKZL9U3pmDuc6KGTrYLwRb9Tsz2c51/ k5Uatv1czeIYJiQCCLAEUhPUET8uvAl7og+aY= MIME-Version: 1.0 Received: by 10.52.35.177 with SMTP id i17mr810194vdj.21.1322239224641; Fri, 25 Nov 2011 08:40:24 -0800 (PST) Received: by 10.220.183.13 with HTTP; Fri, 25 Nov 2011 08:40:24 -0800 (PST) In-Reply-To: References: <4ECF54F1.50203@FreeBSD.org> <201111251609.pAPG97dT008848@slippy.cwsent.com> Date: Fri, 25 Nov 2011 08:40:24 -0800 Message-ID: From: Freddie Cash To: Tom Evans Content-Type: text/plain; charset=UTF-8 X-Content-Filtered-By: Mailman/MimeDel 2.1.5 Cc: hackers@freebsd.org Subject: Re: cron(8) mis-feature with @reboot long after system startup X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 25 Nov 2011 17:02:37 -0000 On Fri, Nov 25, 2011 at 8:37 AM, Tom Evans wrote: > On Fri, Nov 25, 2011 at 4:09 PM, Cy Schubert > wrote: > > Changing the behaviour by default would change the semantics of @reboot, > > altering the behaviour of cron jobs which rely on the brokenness. What > if > > both behaviours are wanted on the same system? Unlikely, as I can't see > > anyone relying on this broken behaviour. Having said that, I'm sure there > > are cron jobs that do rely on the broken behaviour, so it may be best to > > simply deprecate the broken behaviour and make one or the other a command > > line option. > > The problem is that the behaviour is not broken, it works exactly as > described in crontab(5) - it is just confusing. > > It's also slightly nonsensical - the command isn't run at reboot, it > is run at boot. How about leaving @reboot exactly as it is, improving > the docs so that it is clear what @reboot does, and add a @boot to > vixie-cron which would only run at boot time. I think it isn't wise to > change how one strange to use format behaves under FreeBSD when > vixie-cron is a quite ubiquitous choice amongst nix variants. > > With regards to anything that runs at boot, I think dumbly checking > that the boot time was less than N minutes ago is also sub-optimal. If > cron keeps dieing and respawning close to boot time, your cronjob > could trigger multiple times. > > I don't know the exact semantics of kern.boottime - at what point is > the boot time stored? If it is before file systems are mounted, an > unclean file system triggering a foreground fsck could delay boot time > by hours, thereby forcing cron to not think that it is running at boot > time when it is finally started. > Perhaps a call to uptime(1) would be enough? -- Freddie Cash fjwcash@gmail.com