PRIMECLUSTER Global Link Services 説明書 4.1 (伝送路二重化機能編) - Solaris (TM) オペレーティングシステム版 - |
目次
索引
![]() ![]() |
第3章 導入 | > 3.6 オプション機能の設定 | > 3.6.11 ユーザコマンド実行機能の設定 |
NIC切替方式運用時のスクリプトファイル呼出形式および定義ファイルサンプルを以下に示します。
#!/bin/sh # # All Rights Reserved, Copyright (c) FUJITSU LIMITED 2001 # #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 = "hmeX" ] #then # ifconfig $INTERFACE ether $MAC_ADDR1 #else # ifconfig $INTERFACE ether $MAC_ADDR2 #fi ;; 'after') # # script after activate interface # # echo "execute script after activate interface on" $INTERFACE > /dev/console #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 # # 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 |
001 #!/bin/sh 002 # 003 # All Rights Reserved, Copyright (c) FUJITSU LIMITED 2001 004 # 005 #ident "%W% %G% %U% - FUJITSU" 006 # 007 008 # 009 # Control interface for HA-Net 010 # 011 012 # 013 # Params 014 # 015 # $1 activate or inactivate 016 # $2 before or after 017 # $3 physical interface name 018 # $4 address family (IPv6 only) 019 020 # 021 # Set Params 022 # 023 024 INTERFACE=$3 025 IP_ADDR1="192.1.1.1" 026 IP_ADDR2="192.1.2.1" 027 MAC_ADDR1="02:00:00:00:00:00" 028 MAC_ADDR2="02:00:00:00:00:01" 029 030 case "$1" in 031'activate') 032 033 # 034 # Activate interface 035 # 036 case "$2" in 037 'before') 038 # 039 # script before activate interface 040 # 041 042 echo "execute script before activate interface on" $INTERFACE > /dev/console 043 if [ ! $INTERFACE = "hmeX" ] 044 then 045 ifconfig $INTERFACE ether $MAC_ADDR1 046 else 047 ifconfig $INTERFACE ether $MAC_ADDR2 048 fi 049 ;; 050 051 'after') 052 # 053 # script after activate interface 054 # 055 echo "execute script after activate interface on" $INTERFACE > /dev/console 056 ifconfig $INTERFACE mtu 1454 057 if [ ! $INTERFACE = "hmeX" ] 058 then 059 arp -d $IP_ADDR1 060 ping $IP_ADDR2 2 061 else 062 arp -d $IP_ADDR2 063 ping $IP_ADDR1 2 064 fi 065 ;; 066 *) 067 ;; 068 esac 069 070 ;; 071 072 'inactivate') 073 # 074 # inactivate interface 075 # 076 077 case "$2" in 078 'before') 079 # 080 # script before inactivate interface 081 # 082 083 echo "execute script before inactivate interface on" $INTERFACE > /dev/console 084 ;; 085 086 'after') 087 # 088 # script after inactivate interface 089 # 090 091 echo "execute script after inactivate interface on" $INTERFACE > /dev/console 092 ;; 093 094 *) 095 ;; 096 esac 097 098 ;; 099 100 *) 101 ;; 102 esac 103 104 exit 0 |
以下に設定例の説明をします。なお、説明中の[XXX]は設定例の行番号を示します。
#!/bin/sh # # All Rights Reserved, Copyright (c) FUJITSU LIMITED 2002 # #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 # 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 # # All Rights Reserved, Copyright (c) FUJITSU LIMITED 2002 # #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 # 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 |
目次
索引
![]() ![]() |