UPDATE:RE: Help with script

From: bryan.mills@lynx.co.uk
Date: Wed Jun 05 2002 - 09:43:09 EDT


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.



This archive was generated by hypermail 2.1.7 : Sat Apr 12 2008 - 10:48:43 EDT