What is the most cautious way to see if I am already running an instance of
a program and kill that said process?
I'm setting up a shell that will be launched from a cronjob and want to make
sure that if there was an instance of the same process running, that it was
killed up front, before continuing on through the program.


in Bourne shell, I would use the following code:
exec > /dev/null 2>&1
Progname='basename $0'
PIDfile=/var/tmp/$Progname.pid
OLDPID=`cat $PIDfile 2>/dev/null`
test -n $OLDPID && kill -9 $OLDPID

Thanks in advance for any help,
Dan Taylor.

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to