Script to stop a GroupWise agent in a cluster resource

0 Likes
over 7 years ago
If you cannot calculate the time needed so that the GroupWise agents can shut down normally on your cluster without being inadvertently killed by the pkill, you may find this useful script.

The secret is to check for the state of GroupWise agent, while the status is "running" do a sleep. When the status changes to "unused" the script executes the next command.

I hope this helps.
#Cluster unload GroupWise Domain resource
#!/bin/bash
. /opt/novell/ncs/lib/ncsfuncs
# define the IP address
RESOURCE_IP=192.168.1.1
# define the file system type
MOUNT_FS=ext3
#define the volume group name
VOLGROUP_NAME=vmta
# define the device
MOUNT_DEV=/dev/vmta/vmta
# define the mount point
MOUNT_POINT=/media/ext3/vmta
# define NCP server name
NCP_SERVER=c-lnx-mail-vmta-server
# define NCP volume name
NCP_VOLUME=vmta
# Stop domain
ignore_error /etc/init.d/grpwise stop gwdom

# Checking running status <--------- HERE
while [[ `rcgrpwise status gwdom|grep running` == 'Checking status [gwdom]..running' ]]; do sleep 1;done

# Kill domain process
pkill -fx "/opt/novell/groupwise/agents/bin/gwdom @/media/ext3/vmta/vmta/groupwise/agents/share/gwdom.mta"
# Remove GroupWise Domain Secondary IP address
ignore_error del_secondary_ipaddress 192.168.1.2
# Unbind ncpcon
ignore_error ncpcon unbind --ncpservername=$NCP_SERVER --ipaddress=$RESOURCE_IP
# dismount the NCP volume
ignore_error ncpcon dismount $NCP_VOLUME
# Remove resources the IP address
ignore_error del_secondary_ipaddress $RESOURCE_IP
# Close volume
fuser -km $MOUNT_POINT
# unmount the volume
exit_on_error umount_fs $MOUNT_DEV $MOUNT_POINT $MOUNT_FS
# deactivate the volume group
exit_on_error vgchange -a en $VOLGROUP_NAME
ignore_error rmdir $MOUNT_POINT
exit 0

Tags:

Labels:

How To-Best Practice
Comment List
Anonymous
Related Discussions
Recommended