Thanks to the numerous replies. ==================================== Below are 5 which are good enough : Use ptree to find its (stable) parent and then kill that, or use pkill <script_name>. ==================================== I dont think that this solve you problem but: kill -9 ` ps -elf | grep foo | grep -v "grep" | cut -d " " -f5` ==================================== If the name of the process is unique, you can use pkill: pkill foobar or pkill -9 foobar ==================================== #ps -elf | grep nohup | grep -v grep 0 O root 16538 1579 0 99 20 ? 152 13:24:49 ? 0:00 nohup echo AA In my output you see the parent process id is 1579. Now I am killing this process: #kill 1579 ==================================== pgrep PARENT_PROCESS_NAME | xargs kill -9 Thanks U On Fri, Jul 18, 2008 at 2:55 PM, sunhux G <sunhux@gmail.com> wrote: > Hi, > > > > I've started/run a "while ... loop" shell script by issuing > "nohup script_name &". > > Rebooting the server is not an option. > > Problem is in a split of a second after issuing > "ps -ef | grep script_name" > the pid would change again & I'm not able to kill using pid. > > I wrote this script so that I can rapidly check a SAN LUN > path status & email out when the status of the SAN LUN > changed momentarily. We suspect there's transient/quick > transitioning problem with certain SAN LUN & the SAN > vendor told us to check it by issuing a specific command > from the Solaris server. > > I did not insert a "sleep ..." line in the script in case during > the short pause, we missed capturing the state of the SAN > LUN. > > > Perhaps someone has script that could quickly get the > pid of the process, pipe it immediately to the kill command?? > > > Thanks > U _______________________________________________ sunmanagers mailing list sunmanagers@sunmanagers.org http://www.sunmanagers.org/mailman/listinfo/sunmanagersReceived on Fri Jul 18 10:54:27 2008
This archive was generated by hypermail 2.1.8 : Thu Mar 03 2016 - 06:44:11 EST