From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: "Cohen, Andy" Newsgroups: gmane.os.tru64.managers Subject: find out one's own PID when running from cron Date: Fri, 19 May 2006 12:20:00 -0400 Message-ID: <9D592DB37A92234AB635C5585D2D08190430BB86@cobra.pc.cognex.com> NNTP-Posting-Host: main.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: quoted-printable X-Trace: sea.gmane.org 1148055645 32070 80.91.229.2 (19 May 2006 16:20:45 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Fri, 19 May 2006 16:20:45 +0000 (UTC) Original-X-From: tru64-unix-managers-owner-gotm-tru64-unix-managers=m.gmane.org@sws1.ctd.ornl.gov Fri May 19 18:20:42 2006 Return-path: Envelope-to: gotm-tru64-unix-managers@gmane.org Original-Received: from sws1.ornl.gov ([160.91.1.101]) by ciao.gmane.org with smtp (Exim 4.43) id 1Fh7iF-0003Fm-89 for gotm-tru64-unix-managers@gmane.org; Fri, 19 May 2006 18:20:27 +0200 Original-Received: (qmail 2021 invoked by uid 49509); 19 May 2006 16:20:10 -0000 Original-Sender: tru64-unix-managers-owner@ornl.gov Original-Followup-To: poster Precedence: bulk Original-Received: (qmail 2012 invoked from network); 19 May 2006 16:20:10 -0000 Original-Received: from emroute4.ornl.gov (160.91.86.27) by sws1.ornl.gov with SMTP; 19 May 2006 16:20:10 -0000 Original-Received: from emroute4.ornl.gov (localhost [127.0.0.1]) by emroute4.ornl.gov (PMDF V6.2-1x9 #31038) with ESMTP id <0IZI00DD2TDLGA@emroute4.ornl.gov> for tru64-unix-managers@sws1.ctd.ornl.gov (ORCPT tru64-unix-managers@ornl.gov) ; Fri, 19 May 2006 12:20:09 -0400 (EDT) Original-Received: from VIRUSCAN-DAEMON.emroute4.ornl.gov by emroute4.ornl.gov (PMDF V6.2-1x9 #31038) id <0IZI00F02TDFJH@emroute4.ornl.gov> for tru64-unix-managers@sws1.ctd.ornl.gov (ORCPT tru64-unix-managers@ornl.gov) ; Fri, 19 May 2006 12:20:09 -0400 (EDT) Original-Received: from cognex.cognex.com (cognex-out.cognex.com [198.232.29.228]) by emroute4.ornl.gov (PMDF V6.2-1x9 #31038) with ESMTP id <0IZI00DI2TDEG9@emroute4.ornl.gov> for tru64-unix-managers@sws1.ctd.ornl.gov (ORCPT tru64-unix-managers@ornl.gov) ; Fri, 19 May 2006 12:20:03 -0400 (EDT) Original-Received: from atlantis.pc.cognex.com (atlantis.pc.cognex.com [10.10.160.5]) by cognex.cognex.com (8.12.11/8.12.11) with ESMTP id k4JGK1Um020917 for ; Fri, 19 May 2006 12:20:02 -0400 (EDT) Original-Received: from cobra.pc.cognex.com ([10.10.160.30]) by atlantis.pc.cognex.com with Microsoft SMTPSVC(6.0.3790.211); Fri, 19 May 2006 12:20:01 -0400 Original-To: Tru64 Managers X-Envelope-from: Andy.Cohen@cognex.com X-MIMEOLE: Produced By Microsoft Exchange V6.5.7226.0 Thread-Topic: find out one's own PID when running from cron Thread-Index: AcZ7YBO0O59Bl5njQ36EGr+nvo/olA== Content-class: urn:content-classes:message X-Spam-Checker-Version: SpamAssassin 3.1.1 (2006-03-10) on bkup1.ornl.gov X-Spam-Level: X-Spam-Status: No, score=-0.3 required=5.0 tests=AWL,BAYES_40 autolearn=ham version=3.1.1 X-MS-Has-Attach: X-MS-TNEF-Correlator: X-OriginalArrivalTime: 19 May 2006 16:20:01.0932 (UTC) FILETIME=[149984C0:01C67B60] Xref: news.gmane.org gmane.os.tru64.managers:8913 Archived-At: Hi, =20 I have a shell script that runs from cron. It needs to check if there are still previous runs of itself still running and if so it needs to kill them (but not kill itself). I can get the shell script to find all currently running copies of this script but the list includes the current one but I only want to kill the previous ones. How do I get the shell script to find out its own PID? I can do it at the command line but when I try to do it when the script runs from cron I get an error message: =20 ps: no controlling terminal =20 Thanks, Andy