#!/bin/rc
#for each service in /tmp/grid/svcin
#FIRST check if its alive
#IF its alive, harvest the info
#IF its dead, mark it for fixing
for (i in /tmp/grid/svcin/*){
if (! ~ $i '/tmp/grid/svcin/*' && ! ~ $i /tmp/grid/svcin/tcp*){
SVCSTATUS=0
SVCNAME=`{echo $i |awk -F/ '{print $5}'}
touch /tmp/grid/work/svctest$SVCNAME
ls /g/$SVCNAME >>/tmp/grid/work/svctest$SVCNAME &
sleep 6
SVCSTATUS=`{cat /tmp/grid/work/svctest$SVCNAME}
echo service status is $SVCSTATUS hopefully s
if (! ~ $SVCSTATUS '/g/'$SVCNAME'/s'){
echo `{date} service $SVCNAME nonresponsive, moved to mia
>>/tmp/grid/log/log
echo service $SVCNAME not responding, moved to mia
mv /tmp/grid/svcin/$SVCNAME /tmp/grid/miasvc/$SVCNAME
}
if (~ $SVCSTATUS ??*){
SVCCHECK=`{ls /g/$SVCNAME/s}
echo service status is $SVCCHECK hopefully something
if (! ~ $SVCCHECK ?*){
echo `{date} service $SVCNAME nonresponsive, moved
to mia >>/tmp/grid/log/log
echo service $SVCNAME not responding, moved to mia
mv /tmp/grid/svcin/$SVCNAME
/tmp/grid/miasvc/$SVCNAME
}
}
}
}
if (test -e /tmp/grid/work/svctest*) rm /tmp/grid/work/svctest*
echo `{date} svcupdate completed >>/tmp/grid/log/log