| PRIMECLUSTER Global Link Services Configuration and Administration Guide: Redundant Line Control Function 4.2 (for Linux) |
Contents
Index
![]()
|
| Chapter 3 Environment configuration | > 3.6 Setting Option Function | > 3.6.9 Setting User command execution function |
The following shows the script file call format and the definition file sample for the operation in NIC switching mode.
/bin/sh shaX param1 param2 param3 param4
param1
activate: Activated
inactivate: Inactivated
param2
before: Before activation or deactivation
after: After activation or deactivation
param3
ifname: Physical interface name
param4
inet6: Address family (IPv6 only)
* No param4 for IPv4.
#!/bin/sh
#
# All Rights Reserved, Copyright (c) FUJITSU LIMITED 2004
#
#ident "%W% %G% %U% - FUJITSU"
#
#
# Control interface for HA-Net
#
#
# Params
#
# $1 activate or inactivate
# $2 before or after
# $3 physical interface name
# $4 address family (IPv6 only)
#
#
# Set Params
#
#INTERFACE=$3
#IP_ADDR1="xx.xx.xx.xx"
#IP_ADDR2="yy.yy.yy.yy"
#MAC_ADDR1="xx:xx:xx:xx:xx:xx"
#MAC_ADDR2="yy:yy:yy:yy:yy:yy"
cace $# in
3)
ADDRESS_FAMILY="inet"
;;
4)
if [ $4 = "inet6" ]
then
ADDRESS_FAMILY="inet6"
else
ADDRESS_FAMILY="unknown"
fi
;;
*)
ADDRESS_FAMILY="unknown"
;;
esac
if [ $ADDRESS_FAMILY = "inet" ]
then
case "$1" in
'activate')
#
# Activate interface
#
case "$2" in
'before')
#
# script before activate interface
#
# echo "execute script before activate interface on" $INTERFACE > /dev/console
#if [ ! $INTERFACE = "ethX" ]
#then
# ifconfig $INTERFACE
#else
# ifconfig $INTERFACE
#fi
;;
'after')
#
# script after activate interface
#
# echo "execute script after activate interface on" $INTERFACE > /dev/console
#if [ ! $INTERFACE = "ethX" ]
#then
# arp -d $IP_ADDR1
# ping $IP_ADDR2 2
#else
# arp -d $IP_ADDR2
# ping $IP_ADDR1 2
#fi
;;
*)
;;
esac
;;
'inactivate')
#
# inactivate interface
#
case "$2" in
'before')
#
# script before inactivate interface
#
# echo "execute script before inactivate interface on" $INTERFACE > /dev/console
;;
'after')
#
# script after inactivate interface
#
# echo "execute script after inactivate interface on" $INTERFACE > /dev/console
;;
*)
;;
esac
;;
*)
;;
esac
fi
if [ $ADDRESS_FAMILY = "inet6" ]
then
case "$1" in
'activate')
#
# Activate interface
#
case "$2" in
'before')
#
# script before activate interface
#
# echo "execute script before activate interface on" $INTERFACE > /dev/console
;;
'after')
#
# script after activate interface
#
# echo "execute script after activate interface on" $INTERFACE > /dev/console
;;
*)
;;
esac
;;
'inactivate')
#
# inactivate interface
#
case "$2" in
'before')
#
# script before inactivate interface
#
# echo "execute script before inactivate interface on" $INTERFACE > /dev/console
;;
'after')
#
# script after inactivate interface
#
# echo "execute script after inactivate interface on" $INTERFACE > /dev/console
;;
*)
;;
esac
;;
*)
;;
esac
fi
exit 0 |
/bin/sh shaX param1
param1
Primary: Error in a Primary interface
Secondary: Error in a Secondary interface
all: Error in both Primary/Secondary interfaces
#!/bin/sh # # All Rights Reserved, Copyright (c) FUJITSU LIMITED 2004 # #ident "%W% %G% %U% - FUJITSU" # # Control interface for HA-Net # # # Params # # $1 communication line state primary/secondary/all # # # Set Params # #STATE=$1 #PROC="process_name" #kill -15 `/bin/ps -e | /bin/sed -n \ # -e'/'$PROC'$/s/[^0-9 \t].*//p' \ # ` > /dev/null 2>/dev/null #if [ $STATE = "primary" ] #then # echo "execute script Polling fail : primary" > /dev/console #fi #if [ $STATE = "secondary" ] #then # echo "execute script Polling fail : secondary" > /dev/console #fi #if [ $STATE = "all" ] #then # echo "execute script Polling failover" > /dev/console #fi |
/bin/sh shaX param1 param2
param1
establish: Standby patrol established
recover: Standby NIC monitoring recovered
fail: Standby NIC error
param2
Physical interface name of standby NIC: Physical interface name such as ethX
unknown: Standby NIC undecided
#!/bin/sh # # All Rights Reserved, Copyright (c) FUJITSU LIMITED 2004 # #ident "%W% %G% %U% - FUJITSU" # # Control interface for HA-Net # # # Params # # $1 standby NIC state establish/recovery/fail # $2 standby NIC name ethX # # # Set Params # #STATE=$1 #NIC=$2 #if [ $STATE = "fail" ] #then # echo "execute script Patrol fail ($NIC)" > /dev/console #fi #if [ $STATE = "establish" ] #then # echo "execute script Patrol establish ($NIC)" > /dev/console #fi #if [ $STATE = "recover" ] #then # echo "execute script Patrol recover ($NIC)" > /dev/console #fi |
Contents
Index
![]()
|