On Fri, 17 Feb 2006, Michael Moore wrote:
Hello shell script gurus. I'm sure I'm doing this the hard way...so if
you could shed some light.
I'm trying to write a shell script that will only run if it's not
running already, and if it is running, kill the other process. ie:
if ( other copy of me already running)
kill both myself and other copy
else
do some stuff
fi
I imagine you'll want something involving "echo $$ >myscript.pid" and then
perhaps "ps -a | grep `cat myscript.pid` | grep myscript && kill `cat
myscript.pid` && exit"
-J
--------------------
BYU Unix Users Group
http://uug.byu.edu/
The opinions expressed in this message are the responsibility of their
author. They are not endorsed by BYU, the BYU CS Department or BYU-UUG.
___________________________________________________________________
List Info: http://uug.byu.edu/cgi-bin/mailman/listinfo/uug-list