# In DEBUG mode: generate some files under "/tmp" to see, the script is running
if [ "$DBG" = "dbg" ]
then
mkdir -p /tmp/Fujitsu/
tail $SCRIPTLOG 2>/dev/null > $SCRIPTLOG.bk
mv -f $SCRIPTLOG.bk $SCRIPTLOG
echo "$0 V__MP_VERSION__ last ran at `date`" >> $SCRIPTLOG
fi
EECD=`whereis eecd | awk 'NF>1{print $2}'`
if [ "$EECD" = "" ]
then
# either not a system from FUJITSU or no ServerView agents installed - do nothing!
[ "$DBG" = "dbg" ] && echo "Not a system from FUJITSU or ServerView Agents not installed."
exit 0
fi
# test that SFCB is installed
SFCB=`whereis sfcbd | awk 'NF>1{print $2}'`
PEGASUS=""
if [ "$SFCB" = "" ]
then
# test that OpenPegasus is installed
PEGASUS=`whereis cimserver | awk 'NF>1{print $2}'`
if [ "$PEGASUS" = "" ]
then
echo "SFCB or OpenPegasus is required! Cannot recover."
exit 0
else
[ "$DBG" = "dbg" ] && echo "OpenPegasus is installed at: $PEGASUS"
fi
else
[ "$DBG" = "dbg" ] && echo "SFCB is installed at: $SFCB"
fi
if [ "$SFCB" != "" ]
then
SERVICE=`ls -1 /etc/init.d/ /usr/lib/systemd/system/ 2>/dev/null | grep -i sfcb | sed "s/.service//" | head -n 1`
# test that SFCB is running
SFCBRUNNING=`ps -A | grep -i '[s]fcb'`
if [ "$SFCBRUNNING" = "" ]
then
echo "SFCB is not running, starting"
service $SERVICE start
exit 0
fi
[ "$DBG" = "dbg" ] && echo "SFCB is running"
# test that SFCB is listening
SFCBLISTEN=`netstat -nlx | grep -i sfcb`
if [ "$SFCBLISTEN" = "" ]
then
echo "SFCB is not listening, restarting"
service $SERVICE restart
exit 0
fi
[ "$DBG" = "dbg" ] && echo "SFCB is listening"
fi
if [ "$PEGASUS" != "" ]
then
SERVICE=`ls -1 /etc/init.d/ /usr/lib/systemd/system/ 2>/dev/null | grep -i tog-pegasus | sed "s/.service//" | head -n 1`
# test that OpenPegasus is running
PEGASUSRUNNING=`ps -A | grep -i '[c]imserver'`
if [ "$PEGASUSRUNNING" = "" ]
then
echo "OpenPegasus is not running, starting"
service $SERVICE start
exit 0
fi
[ "$DBG" = "dbg" ] && echo "OpenPegasus is running"
# test that OpenPegasus is listening
PEGASUSLISTEN=`netstat -nlx | grep -i tog-pegasus`
if [ "$PEGASUSLISTEN" = "" ]
then
echo "OpenPegasus is not listening, restarting"
service $SERVICE restart
exit 0
fi
[ "$DBG" = "dbg" ] && echo "OpenPegasus is listening"
fi
CIMOMLISTENP=`netstat -vltn | grep $LISTENPORT`
if [ "$CIMOMLISTENP" = "" ]
then
echo "Nothing is listening on port $LISTENPORT, restarting"
service $SERVICE restart
exit 0
fi
[ "$DBG" = "dbg" ] && echo "Port $LISTENPORT is in LISTEN state"
[ "$DBG" = "dbg" ] && echo "Nothing to do"