Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Mailing Lists -> Oracle-L -> Killing process in Linux with all child processes. What is the best way?

Killing process in Linux with all child processes. What is the best way?

From: <J.Velikanovs_at_alise.lv>
Date: Fri, 21 Jan 2005 22:34:45 +0200
Message-ID: <OF4DAFEB04.9E892998-ONC2256F90.006FA6D8-C2256F90.007169A0@alise.lv>


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)



Thank you for teaching me.
http://otn.oracle.com/ocm/jvelikanovs.html
--
http://www.freelists.org/webpage/oracle-l
Received on Fri Jan 21 2005 - 16:27:27 CST

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US