A user-defined command can be executed at a specific timing. For information on execution timing, see "2.2.11 User command execution function". In NIC switching mode, this function can be used to flush an ARP table, change the interface status, and change the MTU length, etc. In GS/SURE linkage mode, this function can be used to send a signal to a specific process, etc. The following settings must be made to execute a user command. See the sample files for information on creating a script file appropriate for a user's environment.
/etc/opt/FJSVhanet/script/interface/sha.interface.sam (When activating or deactivating an IP address)
/etc/opt/FJSVhanet/script/failover/sha.failover.sam (When detected an error in a transfer route)
/etc/opt/FJSVhanet/script/patrol/sha.patrol.sam (When detected a standby patrol error or recovery)
/etc/opt/FJSVhanet/script/host/host.sam
/etc/opt/FJSVhanet/script/service.sh.sam
/etc/opt/FJSVhanet/script/system/monitor.sam
The storage destination and file name of a setup file varies depending on the type and name of a virtual interface.
/etc/opt/FJSVhanet/script/interface/shaX (When activating or deactivating an IP address)
/etc/opt/FJSVhanet/script/failover/shaX (When detected an error in a transfer route)
/etc/opt/FJSVhanet/script/patrol/shaY (When detected a standby patrol error or recovery)
* shaX is the created virtual interface name for NIC switching mode.
* shaY is the created virtual interface name of the standby patrol for NIC switching mode.
/etc/opt/FJSVhanet/script/host/hostIP
* hostIP is the host name or IP address of the virtual interface of the communication target.
However, pay attention to the following point when using the host name:
If the same IP address is defined to two or more host names in the /etc/inet/hosts file, use the host name which is defined in the beginning of the hosts file.
/etc/opt/FJSVhanet/script/service.sh
/etc/opt/FJSVhanet/script/system/monitor
Note
Do not call the operational command for redundancy line control function in the script file.
The commands executed in the script file do not output messages to the standard output. When checking for the contents of the output messages, use the "logger(1)" command of the operating system to output the messages to syslog.
In a clustered system, the script for NIC switching mode of activating or deactivating IP addresses is executed only by active node. It will not run for standby node.
The following shows the script file call format and the definition file sample for the operation in NIC switching mode.
(1) When activated or deactivated an IP address
/bin/sh shaX param1 param2 param3 param4
activate: Activation of a takeover IP address
inactivate: Inactivation of a takeover IP address
create: Activation of a physical NIC (logical IP takeover only)
delete: Inactivation of a physical NIC (logical IP takeover only)
before: Before activation or deactivation
after: After activation or deactivation
ifname: Physical interface name
inet6: Address family (IPv6 only)
* No param4 for IPv4.
#!/bin/sh # # All Rights Reserved, Copyright (c) FUJITSU LIMITED 2011 # #ident "%W% %G% %U% - FUJITSU" # # # Control interface for HA-Net # # # Params # # $1 activate or inactivate or create or delete # $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 # # logger -p daemon.notice "execute script before activate interface on" $INTERFACE #if [ ! $INTERFACE = "hmeX" ] #then # ifconfig $INTERFACE ether $MAC_ADDR1 #else # ifconfig $INTERFACE ether $MAC_ADDR2 #fi ;; 'after') # # script after activate interface # # logger -p daemon.notice "execute script after activate interface on" $INTERFACE #if [ ! $INTERFACE = "hmeX" ] #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 # # logger -p daemon.notice "execute script before inactivate interface on" $INTERFACE ;; 'after') # # script after inactivate interface # # logger -p daemon.notice "execute script after inactivate interface on" $INTERFACE ;; *) ;; esac ;; 'create') # # create physical interface (logical IP takeover only) # case "$2" in 'before') # # script before create interface # # logger -p daemon.notice "execute script before create interface on" $INTERFACE ;; 'after') # # script after create interface # # logger -p daemon.notice "execute script after create interface on" $INTERFACE ;; *) ;; esac ;; 'delete') # # delete physical interface (logical IP takeover only) # case "$2" in 'before') # # script before delete interface # # logger -p daemon.notice "execute script before delete interface on" $INTERFACE ;; 'after') # # script after delete interface # # logger -p daemon.notice "execute script after delete interface on" $INTERFACE ;; *) ;; esac ;; *) ;; esac fi if [ $ADDRESS_FAMILY = "inet6" ] then case "$1" in 'activate') # # Activate interface # case "$2" in 'before') # # script before activate interface # # logger -p daemon.notice "execute script before activate interface on" $INTERFACE ;; 'after') # # script after activate interface # # logger -p daemon.notice "execute script after activate interface on" $INTERFACE ;; *) ;; esac ;; 'inactivate') # # inactivate interface # case "$2" in 'before') # # script before inactivate interface # # logger -p daemon.notice "execute script before inactivate interface on" $INTERFACE ;; 'after') # # script after inactivate interface # # logger -p daemon.notice "execute script after inactivate interface on" $INTERFACE ;; *) ;; esac ;; 'create') # # create physical interface (logical IP takeover only) # case "$2" in 'before') # # script before create interface # # logger -p daemon.notice "execute script before create interface on" $INTERFACE ;; 'after') # # script after create interface # # logger -p daemon.notice "execute script after create interface on" $INTERFACE ;; *) ;; esac ;; 'delete') # # delete physical interface (logical IP takeover only) # case "$2" in 'before') # # script before delete interface # # logger -p daemon.notice "execute script before delete interface on" $INTERFACE ;; 'after') # # script after delete interface # # logger -p daemon.notice "execute script after delete interface on" $INTERFACE ;; *) ;; esac ;; *) ;; esac fi exit 0 |
(2) When detected an error in a transfer route
/bin/sh shaX 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 2011 # #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 `/usr/bin/ps -e | /usr/bin/sed -n \ # -e'/'$PROC'$/s/[^0-9 \t].*//p' \ # ` > /dev/null 2>/dev/null #if [ $STATE = "primary" ] #then # logger -p daemon.notice "execute script Polling fail : primary" #fi #if [ $STATE = "secondary" ] #then # logger -p daemon.notice "execute script Polling fail : secondary" #fi #if [ $STATE = "all" ] #then # logger -p daemon.notice "execute script Polling failover" #fi |
(3) When detected a standby patrol error or recovery
/bin/sh shaX param1 param2
establish: Standby patrol established
recover: Standby NIC monitoring recovered
fail: Standby NIC error
Physical interface name of standby NIC: Physical interface name such as hmeX
unknown: Standby NIC undecided
#!/bin/sh # # All Rights Reserved, Copyright (c) FUJITSU LIMITED 2011 # #ident "%W% %G% %U% - FUJITSU" # # Control interface for HA-Net # # # Params # # $1 standby NIC state establish/recovery/fail # $2 standby NIC name hmeX # # # Set Params # #STATE=$1 #NIC=$2 #if [ $STATE = "fail" ] #then # logger -p daemon.notice "execute script Patrol fail ($NIC)" #fi #if [ $STATE = "establish" ] #then # logger -p daemon.notice "execute script Patrol establish ($NIC)" #fi #if [ $STATE = "recover" ] #then # logger -p daemon.notice "execute script Patrol recover ($NIC)" #fi |
The following shows the script file call format and the definition file sample for the operation in GS/SURE linkage mode.
/bin/sh hostIP
# # All Rights Reserved, Copyright (c) FUJITSU LIMITED 2011 # #ident "%W% %G% %U% - FUJITSU" # # # Control interface for HA-Net # # # Set Params # #PROC="process_name" # # Procedure # # #kill -15 `/usr/bin/ps -e | /usr/bin/sed -n \ # -e'/'$PROC'$/s/[^0-9 \t].*//p' \ # ` > /dev/null 2>/dev/null # |
The following shows the script file call format and a setting example when configuring the service for Redundant Line Control function.
(1) When the service is started
The following shows the script file call format and the definition file sample when the service is started.
/bin/sh service.sh param1
fjsvhanet: Startup of the service for Redundant Line Control function
fjsvhanet-poll: Startup of the transfer path monitoring service for Redundant Line Control function
#!/bin/sh # # All Rights Reserved, Copyright (c) FUJITSU LIMITED 2011 # #ident "%W% %G% %U% - FUJITSU" # # custom initialize script for fjsvhanet and fjsvhanet-poll service # # # Params # # $1 Started service name fjsvhanet or fjsvhanet-poll # case "$1" in 'fjsvhanet') # # add procedure for fjsvhanet service # # logger -p daemon.notice "execute script for fjsvhanet service" # # svcadm restart svc:/network/xxxxxxxx # ;; 'fjsvhanet-poll') # # add procedure for fjsvhanet-poll service # # logger -p daemon.notice "execute script for fjsvhanet-poll service" # # svcadm restart svc:/network/xxxxxxxx # ;; *) ;; esac exit 0 |
(2) When an error is detected by the self-checking function
The following shows the script file call format and the definition file sample for the self-checking function.
/bin/sh monitor param1 param2
driver: GLS driver
daemon: GLS daemon
hungup: A driver or daemon hang detected.
error: A driver or daemon error detected.
process: The abnormal end of the daemon detected.
#!/bin/sh # # All Rights Reserved, Copyright (c) FUJITSU LIMITED 2011 # #ident "%W% %G% %U% - FUJITSU" # # # Control interface for HA-Net # # # Params # # $1 driver ... sha driver # daemon ... hanetctld # $2 hungup ... hanetctld or driver hungup has been detected. # error ... hanetctld or driver i/o error has been detected. # process ... hanetctld process does not exist. # COMPO=$1 ERRKIND=$2 case $COMPO in driver) # # script when a driver error is detected. # ;; daemon) # # script when a daemon error is detected. # ;; esac exit 0 |