1753856 Members
7334 Online
108809 Solutions
New Discussion юеВ

serviceguard scripting

 
SOLVED
Go to solution
p7
Frequent Advisor

serviceguard scripting

hi all

i have a script in cron (cant put it into the package yet) that i need to run that checks if the package actually failed over then does what it has to do. it supposed to look for a filesystem, then go into action. im having a problem with the mechanics there. has anyone done that?

thx in advance
3 REPLIES 3
Matti_Kurkela
Honored Contributor
Solution

Re: serviceguard scripting

You could check if the package filesystem is listed in the output of the "mount" command, or simply check for the existence of a file or directory you *know* exists within the package filesystem.

Check for filesystem:

if mount | grep -q "/packagemountpoint"; then
echo "the package is here, can proceed"
# add commands to do here
else
echo "the package is not active on this node"
fi

Check for a directory inside the filesystem:

if [ -d /packagemountpoint/somedirectory ]; then
echo "the package is here, can proceed"
# add commands to do here
else
echo "the package is not active on this node"
fi

MK
MK
p7
Frequent Advisor

Re: serviceguard scripting

thx i put it in cron on the adoptive node, works perfeclty.

one problem:

i put it for every 5mins, so it sees the filesystem and brings the services up and down (every 5mins). is there a way to say if u see this filesystem, do this one time
and stop?

thx again
Earl_Crowder
Trusted Contributor

Re: serviceguard scripting


Use a flagfile to determine if you need to run. When you start on the primary node, remove the flag file. Check on adoptive node if the directory is mounted, and the file doesn't exist, touch the file and do what you need.

if [ -d /pkgmount/pkgdir ] ; then
if [ ! -f /pkgmount/pkgdir/flagfile ] ; then
touch /pkgmount/pkgdir/flagfile
domythang
fi
fi