Incorporating pkill may simplify this a bit. With -P you can specify a parent process, killing all the children. On Fri, 21 Jan 2005 22:26:00 +0200, J.Velikanovs@xxxxxxxx <J.Velikanovs@xxxxxxxx> wrote: > 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 > > -- > //www.freelists.org/webpage/oracle-l > -- Jared Still Certifiable Oracle DBA and Part Time Perl Evangelist -- //www.freelists.org/webpage/oracle-l