|
From: Leif M. <lei...@ta...> - 2010-02-10 17:23:18
|
Wandrille,
This is a special case for the Wrapper script. If you modify the
shell script so it does not check if the pid file is stale, this
should be pretty easy to do. Simply modify it so it assumes that the
Wrapper is up if the pid file exists at all.
Look for the getpid() function in the script and remove everything
after it reads the pid file. The rest of the script expects pid to
have a value or be "".
Haven't tested it, but this should work:
getpid() {
pid=""
if [ -f "$PIDFILE" ]
then
if [ -r "$PIDFILE" ]
then
pid=`cat "$PIDFILE"`
else
echo "Cannot read $PIDFILE."
exit 1
fi
fi
}
Please post back with the results.
Cheers,
Leif
On Thu, Feb 11, 2010 at 1:29 AM, <wan...@bn...> wrote:
> Hi,
>
> We have two machine load balanced lets say unix1 and unix2
> They both mount the same filesystem.
>
> I want to make sure wrapper can't be started on both machines at the same
> time.
>
> This is how it works now:
> unix1: wrapper.sh start -> pidfile is created
> unix2: wrapper.sh start -> sees the pidfile (since it's the same fs), thinks
> it's a stale pid file (since it's not the same machine), then removes it and
> starts the wrapper
>
> Is there a workaround for this ?
>
> Thanks a lot,
|