From oracle-l-bounce@freelists.org Fri Jan 21 16:17:35 2005 Return-Path: Received: from air891.startdedicated.com (root@localhost) by orafaq.com (8.12.10/8.12.10) with ESMTP id j0LMHZ6I020346 for ; Fri, 21 Jan 2005 16:17:35 -0600 X-ClientAddr: 206.53.239.180 Received: from turing.freelists.org (freelists-180.iquest.net [206.53.239.180]) by air891.startdedicated.com (8.12.10/8.12.10) with ESMTP id j0LMHGui020323 for ; Fri, 21 Jan 2005 16:17:18 -0600 Received: from localhost (localhost [127.0.0.1]) by turing.freelists.org (Avenir Technologies Mail Multiplex) with ESMTP id 3637C72C74B; Fri, 21 Jan 2005 15:32:04 -0500 (EST) Received: from turing.freelists.org ([127.0.0.1]) by localhost (turing [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 31230-47; Fri, 21 Jan 2005 15:32:04 -0500 (EST) Received: from turing (localhost [127.0.0.1]) by turing.freelists.org (Avenir Technologies Mail Multiplex) with ESMTP id AD4B272D8C1; Fri, 21 Jan 2005 15:32:03 -0500 (EST) To: oracle-l@freelists.org Subject: Killing process in Linux with all child processes. What is the best way? MIME-Version: 1.0 Message-ID: From: J.Velikanovs@alise.lv Date: Fri, 21 Jan 2005 22:26:00 +0200 X-MIMETrack: Serialize by Router on ROSS/IT ALISE/LV(Release 5.0.11 |July 24, 2002) at 2005.01.21 22:26:02, Serialize complete at 2005.01.21 22:26:02 Content-type: text/plain Content-Transfer-Encoding: 8bit X-archive-position: 15100 X-ecartis-version: Ecartis v1.0.0 Sender: oracle-l-bounce@freelists.org Errors-To: oracle-l-bounce@freelists.org X-original-sender: J.Velikanovs@alise.lv Precedence: normal Reply-To: J.Velikanovs@alise.lv X-list: oracle-l X-Virus-Scanned: by amavisd-new at freelists.org X-Spam-Checker-Version: SpamAssassin 2.60 (1.212-2003-09-23-exp) on air891.startdedicated.com X-Spam-Status: No, hits=0.3 required=5.0 tests=NO_REAL_NAME autolearn=no version=2.60 X-Spam-Level: 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