Mailing-List: contact cygwin-help@sourceware.cygnus.com; run by ezmlm
List-Subscribe: <mailto:cygwin-subscribe@sources.redhat.com>
List-Archive: <http://sources.redhat.com/ml/cygwin/>
List-Post: <mailto:cygwin@sources.redhat.com>
List-Help: <mailto:cygwin-help@sources.redhat.com>, <http://sources.redhat.com/ml/#faqs>
Sender: cygwin-owner@sources.redhat.com
Delivered-To: mailing list cygwin@sources.redhat.com
Date: Wed, 28 Nov 2001 08:07:15 +0100
From: Corinna Vinschen <cygwin@cygwin.com>
To: cygwin@cygwin.com
Subject: Re: Shell process identification
Message-ID: <20011128080715.U14975@cygbert.vinschen.de>
Mail-Followup-To: cygwin@cygwin.com
References: <006501c1779a$8252add0$2701010a@crosstrust.com>
Mime-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
User-Agent: Mutt/1.2.5i
In-Reply-To: <006501c1779a$8252add0$2701010a@crosstrust.com>; from dmeier@crosstrust.com on Tue, Nov 27, 2001 at 03:23:21PM -0800

On Tue, Nov 27, 2001 at 03:23:21PM -0800, Daniel Meier wrote:
> I want to cron/at a bash script but have it check to see if another instance of the script is already running.
> 
> I did a ps -Wl and a ps -ef while I had the script running and while I saw the /usr/bin/bash executables (my current shell and the shell I wanted to detect) they did not contain enough information to differentiate between the two shells.
> 
> Any ideas of how I can determine this? I thought of using a temp file, but if the script terminates abnormally it might not cleanup it's files, causing the next cron job to not run, thinking that the other script is still running.

A temp file /var/run/<yourTask>.pid containing the PID of the process
should give the information you need.

Corinna

-- 
Corinna Vinschen                  Please, send mails regarding Cygwin to
Cygwin Developer                                mailto:cygwin@cygwin.com
Red Hat, Inc.

--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Bug reporting:         http://cygwin.com/bugs.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/

