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

else
continue;
fi
fi
done
return 0;
}
#############################################################
#
# MONITORING_PROCESS
#
#############################################################
function process_monitor
{
for k in ${APP_TKIT_MONITORING_ELEMENT[@]}
do
result=`UNIX95=yes ps -eo args | grep -i $k | grep -v grep`
if [ -z "$result" ] ; then
$ECHO "ERROR: The process $k is not running. Halting the monitor script."
return 1;
else
continue;
fi
done
return 0;
}
############################################################
#
# MONITORING_PORT
#
############################################################
function port_monitor
{
for k in ${APP_TKIT_MONITORING_ELEMENT[@]}
do
if [[ $ENVIRONMENT = "HP-UX" ]]; then
running=`netstat -an | grep "\.${k}[ ]*\*\.\*[ ]*LISTEN$"`
if [ -z "$running" ] ; then
echo "ERROR: The Application is not running. Port NOT Listening. Halting the monitor script."
return 1;
else
continue;
fi
else
running=`netstat -lnp | grep "\:${k}[ ]*\:[0-9\.]*\:[0-9\.]*\:\*[ ]*LISTEN"`
if [ -z "$running" ] ; then
echo "ERROR: The Application is not running. Port NOT Listening. Halting the monitor script."
return 1;
else
continue;
fi
fi
done
return 0;
}
##################################
#
#Start of Routines
#
#################################
typeset -i exit_code=0
export APP_TKIT_DIR=$APP_TKIT_CONF_DIR
MAINTENANCE_FILE="$APP_TKIT_DIR/toolbox.debug"
ENVIRONMENT=`uname`
case $1 in
validate)
validate_function
;;
start)
start_function
;;
stop)
stop_function
;;
toolbox_monitor)
monitor_function
;;
*)
sg_log 0 "Usage: ${0} [ start | stop | toolbox_monitor | validate ]"
;;
esac
32 MySQL Toolkit scripts