Using SNAplus2 in a High Availability Environment

Advanced Configuration Techniques

commands in the script. The ability to add other SNAplus2 commands gives you a way to specify local recovery actions before allowing the script to end.

For example, suppose you want to monitor a Token Ring LS called TRLS. If it fails, you first try to restart TRLS. If TRLS does not restart, you try to start an SDLC LS called SDLCLS.

Your monitor script might look like this:

#!/bin/ksh

#This script monitors an SNAplus2 package, which uses the

#following SNAplus2 configuration:

#

#A node is configured to run a Token Ring

#LS, TRLS, and an SDLC LS, SDLCLS. TRLS uses a port

#called TRPORT, and SDLCLS uses a port called SDLCPORT.

#If the primary LS ever fails, the script performs three steps

#to restore SNA network connectivity.

#

#Step 1: Attempt local restart of TRLS. If successful, monitor

#the LS, then return to Step 1. Otherwise, go to Step 2.

#

#Step 2: Attempt local failover to SDLCLS. Monitor the LS

#until it fails, then go to Step 3.

#

#Step 3: Exit, which will inform ServiceGuard of a complete

#package failure. Service Guard will then perform

#remote failover.

#

#Add the SNAplus2 command directory to PATH.

PATH=/opt/sna/bin:$PATH

#-------------------------------------------------------------

#STEP 1: Local restart

#-------------------------------------------------------------

#

#Start (or restart) the primary LS. If local restart is

#successful, then loop back to try it again.

#

exitcode=0

while (( $exitcode == 0 )) do

#

#Attempt to start the node. If it is already active,

#the command will have no effect.

#

snapadmin init_node

#

#Attempt to start the port. If it is already active,

#the command will have no effect.

#

snapadmin start_port, port_name=TRPORT

384

Appendix D