Script to kill all child process for a given PID witt - UNIX for Dummies Questions & Answers - Unix Linux Forums

  Go Back    



Script to kill all child process for a given PID

UNIX for Dummies Questions & Answers




Kindly Note - This is a Single User Post by Forum Member witt Regarding:
Script to kill all child process for a given PID.
Please Follow The Primary Link Above to View the Full Discussion.

   
Old 03-21-2002
witt
Guest
 
Posts: n/a
No problem !
You can change the script... look this :

Code:
#!/bin/sh
while true
do
  echo "Enter parent process id  [type quit for exit]"
  read ppid

  if [ $ppid -eq "quit" -o $ppid -eq "QUIT" ];then
     exit 0
  fi

  for i in `ps -ef| awk '$3 == '$ppid' { print $2 }'`
     do
       echo killing $i
       kill $i
     done
done

added code tags for readability --oombera

Last edited by oombera; 02-18-2004 at 04:42 PM..