I'm using the script from TID 7002916 to keep my webaccess agent up. I was trying to modify this script to work for the post office as well, or any other piece of the puzzle. Does anyone here have the scripting knowledge to help out?

Here is what I have.


declare -i CNT=0
#Modify the name of the GroupWise PostOffice agent startup file to match the actual name.
CNT=`ps -aef | grep -v grep | grep -c '@p02.poa'`

if [ $CNT -eq 0 ]
echo "Restarting the GroupWise PostOffice Agent"
echo "Restarted the GroupWise PostOffice" `! date` >> /media/nss/MAIL/Log/gwpoachk.log
#Modify the name of the PostOffice. Check the name by typing the command "rcgrpwise status". Consider the name which is under brackets.
/etc/init.d/grpwise start PO2.PDOM &
mail -s "GroupWise PostOffice restarted" jtreadwell@dickinsonisd.org < /media/nss/MAIL/smtpalertpoa.txt
echo "The GroupWise PostOffice is running"
echo "The GroupWise PostOffice is running" `! date` >> /media/nss/MAIL/Log/gwpoachk.log

If I run it like this it just restarts it every time, even if it is running. I thought maybe the CNT value needed to be different since the original script was running every 2 minutes. I incremented from 0 o 1 and it always shows running even if I unload it. Anyone have any advice?