From owner-freebsd-hackers@FreeBSD.ORG Fri Nov 25 11:06:10 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 213C2106566B for ; Fri, 25 Nov 2011 11:06:10 +0000 (UTC) (envelope-from tevans.uk@googlemail.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 CF17C8FC16 for ; Fri, 25 Nov 2011 11:06:09 +0000 (UTC) Received: by vbbfa15 with SMTP id fa15so4459561vbb.13 for ; Fri, 25 Nov 2011 03:06:09 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=googlemail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type:content-transfer-encoding; bh=bc/tZNJP3g0gDrhysnSfAu7jp5YeEiPwxda0IqneDzc=; b=pY6oKynltAQ19nbtyC/0X+2tuZCr1GVJc6FZJ2XXY9PxJnEy3/IoT4UaAsVa8uHVlj emFQDFe4iLBQ19oGPQGYEHj4OOsW7hau2o5tLh0Pu6G9XvdlouQe1tHrHAZO4WIcG3pw TCnBv9qWufcMKY9R9ezw3sOfNiYp24Mmzv52Y= MIME-Version: 1.0 Received: by 10.52.68.79 with SMTP id u15mr33350050vdt.5.1322217794576; Fri, 25 Nov 2011 02:43:14 -0800 (PST) Received: by 10.52.182.40 with HTTP; Fri, 25 Nov 2011 02:43:14 -0800 (PST) In-Reply-To: <20111125070241.GA7915@DataIX.net> References: <20111125070241.GA7915@DataIX.net> Date: Fri, 25 Nov 2011 10:43:14 +0000 Message-ID: From: Tom Evans To: Jason Hellenthal Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable 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 11:06:10 -0000 On Fri, Nov 25, 2011 at 7:02 AM, Jason Hellenthal 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