Using HP Serviceguard for Linux to Provide High Availability for LAMP, December 2005

Toolkit Script Modifications
The “hamysql.sh” also known as Toolkit Main Script contains the internal functions that
support start/stop of a MySQL instance. While stopping the MySQL instance, this script
terminates the process first and immediately afterwards unmounts the shared volume.
Unmount occurs cleanly only if the instance is properly terminated. The time required to
stop the MySQL instance however varies with the size of the database. To account for
this variable termination duration, minor modifications are needed in the “hamysql.sh”
script.
function stop_mysql_server
{
echo "$(date '+%b %e %T') - Node \"$(hostname)\": Stoping MySQL
daemons"
if [ -f $PID_FILE ]; then
read pid < $PID_FILE
else
echo "$(date '+%b %e %T') - ERROR: Function stop_mysql_server:
The $PID_FILE does not exist."
check_return 1 4
fi
if [ -n $pid ]; then
kill -15 $pid
return_value=$?
if [ $return_value = 0 ]; then
while [ 1 ]
do
if [ -d /proc/$pid ];then
sleep 1
else
break
fi
done
fi
check_return $return_value 4
else
echo "$(date '+%b %e %T') - ERROR: Function stop_mysql_server:
The $PID_FILE was corrupted."
check_return 1 4
fi
}
Since the SELinux security issues are taken care of by setting the correct security contexts
as described in the section “SElinux Considerations”, the following lines from the
hamysql.sh script should be removed.
# Bring SELinux to Permissive mode for MySQL Startup.
#setenforce 0
# Changed mode of SELinux to Enforcing Mode.
#setenforce 1 ;
The above two modifications to the toolkit script - hamysql.sh apply to both the Separate
Package and the Single Package configurations. These changes must be made before
running the LAMP package.
11