tru64-unix-managers (formerly alpha-osf-managers) (1994-2012)
 help / color / mirror / Atom feed
From: bryan.mills@lynx.co.uk
Subject: UPDATE:RE: Help with script
Date: Wed, 05 Jun 2002 14:43:09 +0100	[thread overview]
Message-ID: <TFSAQHAJ@lynx.co.uk> (raw)


Okay,  So there are two distinct camps on this topic.  First, grep for 
the process name, if it exists then exit.  Second, write a temporary lock 
file at the top of the scriptand check that when starting the duplicate 
script.

I have problems with both of these.

grep for the process name PROGRAM1 will find anything in the process list 
called PROGRAM1.  If there were two cron entries, PROGRAM and PROGRAM1 
then grep for PROGRAM when PROGRAM1 is running will foul things up.

The lock file idea fine, but if the script crashes / system gets rebooted 
and leaves the file in place then jobs won't start because of the 
existance of the lock file.  Using the pid may combat this, but our 
server goes a long time without reboots and the risk is there that the 
pid will roll over.

What would work for me is being able to interrogate the ps list and look 
for specific process names, not using grep.  That way, PROGRAM would be 
different to PROGRAM1.  Any ideas if I can do anything along these lines 
?

Regards,

Bryan.



 -----Original Message-----
From: bryan.mills@lynx.co.uk [SMTP:bryan.mills@lynx.co.uk]
Sent: Wednesday, June 05, 2002 10:18 AM
To: tru64-unix-managers@ornl.gov
Subject: Help with script

 -------------------------------------------------------------------------- 
 --

 We have many jobs started from the cron.  Occasionally we end up with
duplicates because the previous execution hasn't completed in time.  Does 

anyone have a script that will check for itself before running, and 'exit 

0' if a previous instance is in the process list.

Bryan.


This message is intended only for the use of the person(s) ("The intended
Recipient(s)") to whom it is addressed.  It may contain information which
is privileged and confidential within the meaning of applicable law.  If
you are not the intended recipient, please contact the sender as soon as
possible.  The views expressed in this communication are not necessarily
those held by LYNX Express Limited.



This message is intended only for the use of the person(s) ("The intended
Recipient(s)") to whom it is addressed.  It may contain information which
is privileged and confidential within the meaning of applicable law.  If
you are not the intended recipient, please contact the sender as soon as
possible.  The views expressed in this communication are not necessarily
those held by LYNX Express Limited.


                 reply	other threads:[~2002-06-05 13:43 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed
read-only archive

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox