[clue-tech] cron jobs off to the races
Bruce Ediger
bediger at inlumineconsulting.com
Sat Jan 2 11:51:45 MST 2010
On Sat, 2 Jan 2010, chris fedde wrote:
> # exclusion
> if test -f $pid
> then
> pid=`cat $pidfile`
> if kill -0 $pid
> then
> echo $0 running as $pid > STDERR
> exit 1
> fi
> fi
> echo $$ > $pidfile
Let me emphasize that you want to do the "kill -0 $PID" technique, even if
it means mucking around with a PID in a file in /var/run (or whatever).
DO NO EVEN CONSIDER doing a "ps -ef | grep SomeProgramName" - it is
unreliable in some marginal situations, and it WILL cause you trouble.
Only amateurs do the "ps -ef | grep ProgName" thing.
More information about the clue-tech
mailing list