Thanks for your help.
Your method works to only only level of child process , what about if the child process has sub child process
see the following example :-
suppose, if we want to kill PID=1200, we would like to kill 1520 1544 1508
$ ps -ef
UID PID PPID TTY STIME COMMAND
Administ 820 1 0 22:48:31 /usr/bin/bash
Administ 860 820 0 22:48:35 /usr/bin/bash
Administ 1200 860 0 22:48:37 /usr/bin/bash
Administ 1520 1200 0 22:48:38 /usr/bin/bash
Administ 1544 1520 0 22:53:15 /usr/bin/bash
Administ 1508 1544 0 22:53:19 /usr/bin/ps
Quote:
Originally posted by witt
Trie this :
#!/bin/sh
echo "Enter the parent process ID"
read ppid
for i in `ps -ef| awk '$3 == '${ppid}' { print $2 }'`
do
echo killing $i
kill -9 $i
done
I hope help you
Witt