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 The script I've got now is named "loopy.sh" and at the moment just has a "while [ true ]" loop that does some stuff. In the script I can check if it's already running with "ps aux | grep loopy.sh | wc -l". If it is running, I don't know how to kill it. It shows up like this in ps: $ ps aux | grep loopy liney 1000 0.0 0.1 18644 572 std S 9:52PM 0:00.00 bash ./loopy.sh I don't think "killall bash" would be a good idea because it could kill other stuff too. What's the best way to identify and kill the right script? Thank you! -- Michael Moore ------------------------------- www.stuporglue.org -- Donate your used computer to a student that needs it. -------------------- 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