RE: Checking if a script is already running ...

RE: Checking if a script is already running ...

 

  

A lot of our scripts here will simply create a lock file when they run. The
first thing they do when starting is to check for the lock file, and if it
finds it, the script exits without doing anything. This is mainly used by
our cron jobs so that we prevent multiple instances of the same script gettig
things tied in a knot.

Cheers,

Paul


>-- Original Message --
>To: "LazyDBA Discussion" <[Email address protected]
>From: "benbart" <oracledba-ezmlmshield-x69180235.[Email address protected]
>Date: Mon, 3 Jul 2006 16:27:29 +1200
>Subject: Checking if a script is already running ...
>
>
>Hi all,
>
>Does anyone have a smarter script to check whether a certain script is already
>running and if so exit from the script instead of running another instance
>of
>the script?
>
>At the moment, am checking it using ps -ef | grep [scriptname], but found
>out
>that this is not a reliable test as someone could be more'ing or cat'ting
>a
>file and I am mistakenly taking it as the script running ...
>
>Any advise or tips will be very much appreciated ... thanks in advance ...
>
>
>
>
>
>--------
>website: http://www.LazyDBA.com
>Please don't reply to RTFM questions
>Oracle documentation is here: http://tahiti.oracle.com
>To unsubscribe: see http://www.lazydba.com/unsubscribe.html
>To subscribe: see http://www.lazydba.com
>By using this list you agree to these terms:http://www.lazydba.com/legal.html


Oracle LazyDBA home page