Problems with periodic scripts in jails [Cron <operator@sosai> /usr/libexec/save-entropy]

Dan Nelson dnelson at allantgroup.com
Wed Jun 2 16:11:51 GMT 2004


In the last episode (Jun 03), Bruce Evans said:
> On Wed, 2 Jun 2004, Josef Karthauser wrote:
> > Ok, I've found the cause of the problem.  Cron is spawning more
> > than one copy of the entropy script...
> 
> Cron has been filling my mailbox with complaints about this for
> years. (I only partially filled the mailbox of the author of the
> entropy script with complaints about it 3 or 4 times :-).  In my
> case, the multiple crons are caused by /usr being nfs-mounted and the
> server being down.  cron forks OK, but each copy blocks waiting for
> something in /usr.  When the server comes back up, a thundering herd
> of entropy scripts run and clobber each others' rotation of the
> entropy files. Cron normally runs the entropy script every 11
> minutes, so the herd grows quickly.  The herd (or perhaps other
> herds) also exhausts pipe kva on machines with small amounts of RAM
> (64M) while waiting.

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? :)

-- 
	Dan Nelson
	dnelson at allantgroup.com


More information about the freebsd-current mailing list