Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Mailing Lists -> Oracle-L -> Killing process in Linux with all child processes. What is the best way?
Hi ALL,
Looks like off topic, but it can be useful for Oracle administration
purposes on Linux (Unix) platform.
I have need to kill one of my shell scripts in case of timeout is off. Not just single process but all that is relative to it.
After searching thought net I have wrote my routine. Looks like there is place for improvement. Can somebody recommend one, or somebody has more elegant way how to achieve the goal.
#!/bin/bash
# there $1 is pid of the process
v_pforkill=`pstree -p $1 |
awk -F"-" '{NF>0;for (i=1;i<=NF;i++) print $i}' |
sort -u |
awk -F"(" '{print $2}' |
awk -F")" '{print $1}' |
sort -u |
awk '{ORS=" "; print $1 }'`
kill -9 $v_pforkill
With all my respects,
Jurijs
+371 9268222 (+2 GMT)
-- http://www.freelists.org/webpage/oracle-lReceived on Fri Jan 21 2005 - 16:27:27 CST