?? WTF did you change? Just adding the shell ? It was a snippet.
Also, to the op - you have to code in error handling for script
failure. None of this is magic.
At 10:15 7/3/2006, Avneesh wrote:
>Kirt Thomas,
>
>I think it should be like this. Correct me If I m wrong, Please.
>
>#!/bin/sh
>
>FN=/tmp/flag.tmp
>if [ ! -f $FN ]; then
> touch $FN
> #Run your Script here
> rm $FN
>else
> echo "Script $program is already active
>fi
>
>Thanks and Best Regards,
>
>Avneesh Kumar Rathor
>
>
>
>
>"Shaikh Ismail " <oracledba-ezmlmshield-x13317537.[Email address protected]
>
>3 July 2006 08:45 EST
>
>To
>"LazyDBA Discussion" <[Email address protected]
>cc
>
>Subject
>Re: Checking if a script is already running ...
>
>
>
>
>
>
>What happens to the semaphore file if the script falls over before it
>gets around to removing it?
>--
>shaikh i
>
>
>Kirt Thomas wrote:
> > Semaphore files are your friend. Here's a snippet to add to the
> > beginning of your script...
> >
> > FN=/tmp/flag.tmp
> > if [ -f $FN ]; then
> > touch $FN
> > #Run your Script here
> > rm $FN
> > else
> > echo "Script $program is already active
> > fi
> >
> > The program starts, if it's not running (no semaphore file) then it
> > creates the semaphore file and runs your script, other wise it exits.
> >
> > At 13:42 7/2/2006, benbart wrote:
> >> 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
> >
> >
> >
> > --------
> > 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
> >
>
>
>--------
>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
>
>
>
>
>Whilst this email has been checked for all known viruses, recipients
>should undertake their own virus checking as Xansa will not accept
>any liability whatsoever.
>
>This email and any files transmitted with it are confidential and
>protected by client privilege. It is solely for the use of the
>intended recipient.
>Please delete it and notify the sender if you have received it in
>error. Unauthorised use is prohibited.
>
>Any opinions expressed in this email are those of the individual and not
>necessarily the organisation.
> Xansa, Registered Office: 420 Thames Valley Park Drive,
> Thames Valley Park, Reading, RG6 1PU, UK.
> Registered in England No.1000954.
> t +44 (0)8702 416181
> w www.xansa.com
>
>
>--------
>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