HP Serviceguard Developer's Toolbox Version B.12.00.00 For HP-UX and Linux

exit $exit_code
Application Start Script, (start_app.sh):
This script must be written by the user to start the application that is being packaged using the
Toolbox. The sample script given here is used to start MySQL server.
#!/bin/sh
#
###############################################
# This script starts up the application
#
CONFIGURATION_FILE_PATH="/mysql/my.cnf"
PID_FILE="/var/run/mysqld/mysqld. pid"
STARTUP_RETRIES=10 hostname==`
hostname`
###############################################
echo "$(date '+%b %e %T') - Node \"$(hostname)\": Starting Application daemons." options=" --
pid-file=$PID_FILE "
if [ ! -z $CONFIGURATION_FILE_PATH ] && [ -f $CONFIGURATION_FILE_PATH ];
then options="--defaults-file=$CONFIGURATION_FILE_PATH $options"
elif [ ! -z $ DATA_DIRECTORY ] && [ -d $ DATA_DIRECTORY ];
then
options="--defaults-file=$ DATA_DI RECTORY/my.cnf $options"
else
echo "$(date '+%b %e %T') - Node \"$(hostname)\": ERROR :
Application Start up failed: Application configuration file not specified."
exit 1
fi
safe_mysqld $options &
ret_value=$?
if [[ $ret_value != 0 ]];
then
echo "ERROR: Application Start up failed " exit 1
fi
# Check if the pid file is ready.
counter=0
while :;
do
if [ -f $PID_FILE ]; then
break
else
if [ $counter -ge $STARTUP_RETRIES ]; then
echo "$(date '+%b %e %T') - ERROR: Application failed to create PID file $PID_FILE" exit 1
else
sleep 1
let counter="$counter+1"
fi
fi
done
Application Stop Script (stop_app.sh):
This script must be written by the user to stop the application that is being packaged using the
Toolbox. The following application stop script is written to stop MySQL server.
#!/bin/sh
#
###############################################
# This script halts the Application.
# CONFIGURATION_FILE_PATH="/mysql/my.cnf"
PID_FILE="/var/run/mysqld/mysqld. pid"
STARTUP_RETRIES=10
hostname=` hostname`
###############################################
echo "$(date '+%b %e %T') - Node \"$(hostname)\": Stopping Application daemons"
if [ -f $PID_FILE ];
then
read pid < $PID_FILE
else
echo "$(date '+%b %e %T') - ERROR: The $PID_FILE does not exist."
return 1
fi
if [ -n $pid ];
33