Setting up HP SIM 5.x on an HP-UX Serviceguard Cluster (448492-002, January 2009)

Appendix A hahpsim.sh
#! /sbin/sh
# Copyright (c) 2006 Hewlett-Packard Development Company, L.P.
# High Availability HP System Insight Manager (SIM) script to
# start, stop, and monitor the hpsim product
# Usage: hahpsim.sh <action>
# where action is start, stop, or monitor
MONITOR_INTERVAL=5
case $1 in
start)
# start the database and then hpsim
/sbin/init.d/hpsmdb.sg start
sleep 15
/opt/mx/lbin/mxdomainmgr
/opt/mx/lbin/mxdtf
;;
stop)
# stop hpsim and then the database
/opt/mx/bin/mxstop
sleep 45
/sbin/init.d/hpsmdb.sg stop
sleep 30
;;
monitor)
# monitor the database and hpsim and make sure they are still running
# if product is not running then exit with error
echo $(date) Starting High Availability HP SIM Monitoring
while true
do
# check to see if postmaster (database) is still running
ps -ef | grep -v grep |grep hpsmdb |grep -q postmaster
if [[ $? -ne 0 ]]
then
# postmasster (database) is not running
echo $(date) Database is not running, exiting monitor
exit 1
fi
# now check to see if hpsim is still running
# this require checking for mxdominmgr and mxdtf
ps -ef | grep -v grep | grep -q mxdomainmgr
if [[ $? -ne 0 ]]
then
# mxdomainmgr is not running
echo $(date) mxdomainmgr is not running, exiting monitor
exit 2
fi