From owner-freebsd-current@FreeBSD.ORG Wed Jun 2 12:47:06 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 B3F5316A4CE for ; Wed, 2 Jun 2004 12:47:06 -0700 (PDT) Received: from smtpout.mac.com (smtpout.mac.com [17.250.248.47]) by mx1.FreeBSD.org (Postfix) with ESMTP id 969FC43D55 for ; Wed, 2 Jun 2004 12:47:06 -0700 (PDT) (envelope-from cswiger@mac.com) Received: from mac.com (smtpin08-en2 [10.13.10.153]) by smtpout.mac.com (8.12.6/MantshX 2.0) with ESMTP id i52Jl1si018852; Wed, 2 Jun 2004 12:47:02 -0700 (PDT) Received: from [10.1.1.193] (nfw2.codefab.com [199.103.21.225] (may be forged)) (authenticated bits=0)i52Jkxw2020508; Wed, 2 Jun 2004 12:47:01 -0700 (PDT) In-Reply-To: <20040602161148.GA3067@dan.emsphone.com> 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> Mime-Version: 1.0 (Apple Message framework v618) Content-Type: text/plain; charset=US-ASCII; format=flowed Message-Id: <9C375698-B4CD-11D8-9C6A-003065ABFD92@mac.com> Content-Transfer-Encoding: 7bit From: Charles Swiger Date: Wed, 2 Jun 2004 15:46:58 -0400 To: Dan Nelson 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 19:47:06 -0000 On Jun 2, 2004, at 12:11 PM, Dan Nelson wrote: > A nice addition to cron might be a way to tell it that certain jobs > should be single-instance. I know about half of my cron jobs look > like: > > /usr/local/bin/lockfile -r 1 -l 3600 /tmp/runjob.LCK && ( runjob ; rm > /tmp/runjob.LCK ) > > and it'd be handy if cron would do this internally (no physical > lockfiles needed). The least intrusive way would be to add a magic > variable similar to MAILTO; NO_OVERLAP=1 or something. Anyone up for a > Junior Userland Hacker project? :) 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? 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? 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. -- -Chuck