Script to monitor the GroupWise status and auto-restart if its down

  • 7002918
  • 06-Apr-2009
  • 02-Jan-2014

Environment

Novell GroupWise 7
Novell GroupWise 8
Novell Open Enterprise Server 2 (OES 2)
Novell SUSE Linux Enterprise Server 10
Novell Messenger 2.2

Situation

GroupWise Agents/GWIA/WebAccess stops intermittently.
GroupWise Agents (MTA & POA) status shows a "unused" or "dead".
GroupWise Internet Agent (GWIA) status shows as "unused" or "dead".
GroupWise WebAccess Agent status shows as "unused" or "dead".
GroupWise Messenger Agent status shows as "unused" or "dead".

Resolution

In very rare cases it can happen that a GroupWise process dies and stops working. For this you can use GWHA (GroupWise High Availability). How to use and install GWHA is documented in the administration guide and in the installation guide. Some customers prefer not to use the GWHA functionality or use GroupWise Messenger for which there is no GWHA functionality available. In the latest version of GroupWise 8 and GroupWise Messenger all know causes of the service the stop working have been solved.

This document is intended to provide a workaround for customers that don't want to use GWHA. One can make use to these scripts that will help in minimizing the downtime.

Here is a sample script to manage agent status. This script checks to see if the GroupWise MTA/POA/GWIA/WebAccess agent is running, if not than it restarts it and sends an e-mail notification.


GroupWise MTA

#!/bin/bash

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

if [ $CNT -eq 0 ]
then
echo "Restarting the GroupWise MTA"
echo "Restarted the GroupWise MTA" `! date` >> /var/log/novell/groupwise/gwmtachk.log
#Modify the name of the domain to match the actual name. You can check the name by running "rcgrpwise status". Consider the one in brackets.
/etc/init.d/grpwise start domain_name &
mail -s "GroupWise MTA restarted" emailaddress@yourdomain.com < /var/log/novell/groupwise/smtpalertmta.txt
else
echo "The GroupWise MTA  is running"
fi


GroupWise POA

#!/bin/bash

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

if [ $CNT -eq 0 ]
then
echo "Restarting the GroupWise POA"
echo "Restarted the GroupWise POA" `! date` >> /var/log/novell/groupwise/gwachk.log
#
#Modify the name of the Post Office to match the actual name. You can check the name by running "rcgrpwise status". Consider the one in brackets.
/etc/init.d/grpwise start post_office.poa &
mail -s "GroupWise WebAccess restarted" emailaddress@yourdomain.com < /var/log/novell/groupwise/smtpalertpoa.txt
else
echo "The GroupWise POA is running"
fi


GroupWise Internet Agent

#!/bin/bash

declare -i CNT=0
#Modify the name of the GroupWise Internet Agent startup file to match the actual name.
CNT=`ps -aef | grep -v grep | grep -c '@GWIA.cfg'`

if [ $CNT -eq 0 ]
then
echo "Restarting the GroupWise Internet Agent"
echo "Restarted the GroupWise Internet Agent" `! date` >> /var/log/novell/groupwise/gwiachk.log
#
#Modify the name of the GWIA to match the actual name. You can check the name by running "rcgrpwise status". Consider the one in brackets.
/etc/init.d/grpwise start domain.GWIA &
mail -s "GWIA restarted" emailaddress@yourdomain.com < /var/log/novell/groupwise/smtpalertgwia.txt
else
echo "The GWIA is running"
fi


GroupWise WebAccess

#!/bin/bash

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

if [ $CNT -eq 0 ]
then
echo "Restarting the GroupWise WebAccess"
echo "Restarted the GroupWise WebAccesss" `! date` >> /var/log/novell/groupwise/gwachk.log
#
#Modify the name of the WebAccess to match the actual name. You can check the name by running "rcgrpwise status". Consider the one in brackets.
/etc/init.d/grpwise start WEBAC80A &
mail -s "GroupWise WebAccess restarted" emailaddress@yourdomain.com < /var/log/novell/groupwise/smtpalertwebaccess.txt
else
echo "The GroupWise WebAccess is running"
fi

Novell Instant Messenger


#!/bin/bash

declare -i CNT=0
#Check if the Messenger is running or not.
CNT=`ps -aef | grep -v grep | grep -c 'strtup.ma'`

if [ $CNT -eq 0 ]
then
echo "Restarted the Messenger Agent" `! date` >> /var/log/novell/groupwise/ma.log
/etc/init.d/novell-nmma start
else
echo "The Messenger Agent is running"
fi

Copy the above content in a file and make that file as executable.


Make sure to execute the script with the help CRON job.

Additional Information

How to write shell script

Following steps are required to write shell script:

(1) Use any editor like vi or mcedit to write shell script.
(2) After writing shell script set execute permission for your script as follows
syntax:
chmod permission your-script-name

Examples:
$ chmod +x your-script-name
$ chmod 755 your-script-name

Note: This will set read write execute(7) permission for owner, for group and other permission is read and execute only(5).

(3) Execute your script as
syntax:
bash your-script-name
sh your-script-name
./your-script-name

Examples:
$ bash bar
$ sh bar
$ ./bar

NOTE In the last syntax ./ means current directory, But only . (dot) means execute given command file in current shell without starting the new copy of shell, The syntax for . (dot) command is as follows
Syntax:
. command-name

Example:
$ . foo