HP (Hewlett-Packard) HP-UX SNAplus2 Network Card User Manual


 
Appendix D 385
Using SNAplus2 in a High Availability Environment
Advanced Configuration Techniques
#
# Attempt to start the LS. If the LS is configured to
# be initially active, the command will have no effect.
#
snapadmin start_ls, ls_name=TRLS
#
# Monitor the primary LS again to see if local restart
# was successful. Only allow 30 seconds for the LS to
# become active.
#
snapmon -i1 -r30 TRLS
#
# Since snapmon returned, the LS is no longer active.
# Save the exit code. An exit code of zero means the
# LS was active at one time, so try local restart again.
# Otherwise, go to Step 2.
#
exitcode=$?
done
#-------------------------------------------------------------
# STEP 2: Local failover
#-------------------------------------------------------------
#
# Since snapmon returned with a non-zero exit code, the primary
# LS cannot be activated. Attempted local failover, which
# means:
#
# 1. Start the backup LS.
#
# NOTE: The active node must be configured to run the backup
# LS.
#
snapadmin start_ls, ls_name=SDLCLS
#
# Monitor the backup LS to see if local failover was
# successful. Allow 90 seconds for the LS to become active.
#
snapmon -i1 -r90 SDLCLS
#-------------------------------------------------------------
#STEP 3: Exit
#-------------------------------------------------------------
#
# Since snapmon returned, the backup LS is not active. Inform
# ServiceGuard that this package has failed. ServiceGuard will
# perform remote failover.
exit 0
Notice that this shell script uses the return code of snapmon to
determine what action to take. If snapmon returns 0, the TRLS link
station was active at some point while snapmon was running. If that is
the case, it makes sense to simply attempt to restart the LS. If snapmon
returns with a non-zero value, however, the LS failed to start for the
entire initialization period (about 30 seconds). If that happens, the script