From owner-freebsd-current@FreeBSD.ORG Wed Jun 2 13:24:46 2004 Return-Path: Delivered-To: freebsd-current@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id B55C216A4CE for ; Wed, 2 Jun 2004 13:24:46 -0700 (PDT) Received: from smtpout.mac.com (smtpout.mac.com [17.250.248.89]) by mx1.FreeBSD.org (Postfix) with ESMTP id 88BE343D3F for ; Wed, 2 Jun 2004 13:24:46 -0700 (PDT) (envelope-from cswiger@mac.com) Received: from mac.com (smtpin08-en2 [10.13.10.153]) by smtpout.mac.com (Xserve/MantshX 2.0) with ESMTP id i52KOjWw007407; Wed, 2 Jun 2004 13:24:45 -0700 (PDT) Received: from [10.1.1.193] (nfw2.codefab.com [199.103.21.225] (may be forged)) (authenticated bits=0)i52KOiw2003306; Wed, 2 Jun 2004 13:24:45 -0700 (PDT) In-Reply-To: <20040602200708.GA1847@ack.Berkeley.EDU> References: <20040602134523.GA26835@genius.tao.org.uk> <20040602140148.GA27036@genius.tao.org.uk> <20040602140923.GA27070@genius.tao.org.uk> <20040603011806.E25331@gamplex.bde.org> <20040602161148.GA3067@dan.emsphone.com> <9C375698-B4CD-11D8-9C6A-003065ABFD92@mac.com> <20040602200708.GA1847@ack.Berkeley.EDU> Mime-Version: 1.0 (Apple Message framework v618) Content-Type: text/plain; charset=US-ASCII; format=flowed Message-Id: Content-Transfer-Encoding: 7bit From: Charles Swiger Date: Wed, 2 Jun 2004 16:24:44 -0400 To: Mike Hunter X-Mailer: Apple Mail (2.618) cc: current@freebsd.org Subject: Re: Problems with periodic scripts in jails [Cron /usr/libexec/save-entropy] X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: Discussions about the use of FreeBSD-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 02 Jun 2004 20:24:46 -0000 On Jun 2, 2004, at 4:07 PM, Mike Hunter wrote: >> If a cron job (eg, a shell script) doesn't perform whatever locking it >> needs for itself, what happens when someone runs the script by hand? > > For stuff that I do, when you run the script by hand, you see when it's > done by returning to the prompt, so you're not likely to run it until > it's > finished. Oh, sure, the user isn't likely to run the script again if they are waiting for the prompt to return. However, it's not difficult to imagine cron kicking off the script while the user is also running it, or for the script to already be running via cron before the user starts up a second one, etc... >> What happens to cron's "internal locking" if one restarts cron? Why >> jump through hoops to avoid creating lockfiles if you're going to need >> some persistent mechanism to track locks when/if cron terminates, >> anyway? > > I've restarted cron once due to a time zone error, other than that, > cron > tends to restart when the machine is booted, and that's about it :) > Maybe > some day I'll be hardcore enough to set up systems that put cron at > risk, > but I think for the average user it's not a huge concern. You're right: this isn't a huge concern. Neither is it something which can be entirely ignored, at least not safely. >> My suggestion would be to move the invocation of lockfile into the >> runjob script itself, so that your crontab is smaller and less >> cluttered, and your runjob scripts become smart enough to fend for >> themselves. > > That's a good suggestion. I do think that cron itself strongly > influences > the need for locking in some situations, and that it therefore might be > appropriate to put functionality to deal with it in cron. I drooled > when > I read the initial suggestion :) Fair enough. :-) The initial suggestion was interesting enough, sure, but a little well-placed criticism results in stronger ideas... -- -Chuck