[RndTbl] Potentially long cron jobs

Peter O'Gorman peter at pogma.com
Thu Apr 1 16:57:59 CDT 2010

On 04/01/2010 01:18 PM, Sean Walberg wrote:
> #!/bin/bash
> TURD=/var/run/mycron.lock
> if [ -f $TURD ]; then
>  exit
> fi
> touch $TURD
> # do stuff
> rm $TURD

I find it helpful to have:
trap "rm -f $TURD" 0

So that the file will be removed when the shell exits.

I have also used the procmail 'lockfile' command for situations where I
wanted a shorter term lock.


More information about the Roundtable mailing list