後処理のシェルスクリプトには複写元ボリューム(RepSrc.Post)と複写先ボリューム(RepDst.Post)を用意し、以下のディレクトリ配下に格納されています。処理の必要性に応じてシェルスクリプトをカスタマイズしてください。
非クラスタ運用の場合
/etc/opt/FJSVswsrp/shディレクトリ配下 |
クラスタ運用の場合
/etc/opt/FJSVswsrp/<論理ノード名>/shディレクトリ配下 |
RepSrc.post(複写元ボリューム後処理のシェルスクリプト)
1: #!/bin/sh 2: 3: # AdvancedCopy Manager 4: # All Rights Reserved, Copyright FUJITSU LIMITED, 2002-2008 5: 6: # 7: # Post-processing of Replication(Source) processing 8: # 9: # Argument: $1 Device name of Source disk 10: # 11: # Error number 12: # 2: Argument error 13: # 11: mount error 14: 15: # Argument check 16: case $# in 17: 1) 18: ;; 19: *) 20: exit 2 21: ;; 22: esac 23: 24: device=$1 25: 26: # Device type check 27: # Determination postprocessing file name 28: trans="`echo $device | /usr/bin/grep -e "/dev/dsk/" -e "/dev/disk/"`" 29: lvmtrans="`echo $device | /usr/bin/grep "/dev/"`" 30: vxpvtrans="`echo $device | /usr/bin/grep "/dev/vx/dmp/"`" 31: if [ "$trans" != "" ] 32: then 33: dev_type="physical" 34: # /dev/dsk/c?t?d? -> c?t?d? 35: dev="`echo $device | /usr/bin/sed -e "s/\/dev\/dsk\///" -e "s/\/dev\/disk\//_hppv_/"`" 36: post_file="/etc/opt/FJSVswsrp/"$SWSTGNODE"/data/DEFAULT/"$dev".spre" 37: fstype_file="/etc/opt/FJSVswsrp/"$SWSTGNODE"/data/DEFAULT/"$dev".sfstype" 38: elif [ "$vxpvtrans" != "" ] 39: then 40: dev_type="vxvm_pv" 41: # /dev/vx/dmp/XXXX -> XXXX 42: dev="`echo $device | /usr/bin/awk -F\/ '{ print $5 }'`" 43: post_file="/etc/opt/FJSVswsrp/"$SWSTGNODE"/data/DEFAULT/"$dev".spre" 44: fstype_file="/etc/opt/FJSVswsrp/"$SWSTGNODE"/data/DEFAULT/"$dev".sfstype" 45: elif [ "$lvmtrans" != "" ] 46: then 47: dev_type="logical" 48: # /dev/vgXX -> vgXX 49: dev="`echo $device | /usr/bin/awk -F\/ '{ print $3 }'`" 50: post_file="/etc/opt/FJSVswsrp/"$SWSTGNODE"/data/DEFAULT/"$dev".spre" 51: fstype_file="/etc/opt/FJSVswsrp/"$SWSTGNODE"/data/DEFAULT/"$dev".sfstype" 52: else 53: exit 0 54: fi 55: 56: err_log_path="/var/opt/FJSVswsrp/"$SWSTGNODE"/log" 57: 58: # Confirmation of postprocessing 59: if [ ! -r $post_file ] 60: then 61: exit 0 62: fi 63: post="`/usr/bin/cat $post_file | /usr/bin/cut -d',' -f1`" 64: mount_point="`/usr/bin/cat $post_file | /usr/bin/cut -d',' -f2`" 65: 66: # Confirmation of FStype 67: if [ ! -r $fstype_file ] 68: then 69: fs="" 70: else 71: fs="`/usr/bin/cat $fstype_file`" 72: fi 73: 74: # No processing 75: # When Src device cannot be unmounted --- 1 76: # When Src device was not mounted --- 3 77: # When Src devices of volume group cannot be unmounted --- 4 78: # When Src devices of volume group was not mounted --- 6 79: # When Src devices is a VxVM physical device --- 7 80: if [ "$post" = "none" ] 81: then 82: /usr/bin/rm -rf $post_file 2> /dev/null 83: /usr/bin/rm -rf $fstype_file 2> /dev/null 84: exit 0 85: fi 86: 87: # mount processing 88: if [ "$post" = "mount" ] 89: then 90: # When Src device can be unmounted --- 2 91: if [ "$dev_type" = "physical" ] 92: then 93: /usr/bin/df -l $device > /dev/null 2>&1 94: if [ $? != 0 ] 95: then 96: if [ ! -r $fstype_file ] 97: then 98: /usr/sbin/mount $device $mount_point 2> /dev/null 99: else 100: if [ "$fs" = "" ] 101: then 102: /usr/sbin/mount $device $mount_point 2> /dev/null 103: else 104: /usr/sbin/mount -F $fs $device $mount_point 2> /dev/null 105: fi 106: fi 107: if [ $? != 0 ] 108: then 109: retry_count=3 110: sleep_time=1 111: result_flag=1 112: 113: while [ $retry_count -gt 0 ] 114: do 115: if [ ! -r $fstype_file ] 116: then 117: /usr/sbin/mount $device $mount_point > $err_log_path/$dev.mount 2>&1 118: else 119: if [ "$fs" = "" ] 120: then 121: /usr/sbin/mount $device $mount_point > $err_log_path/$dev.mount 2>&1 122: else 123: /usr/sbin/mount -F $fs $device $mount_point > $err_log_path/$dev.mount 2>&1 124: fi 125: fi 126: if [ $? != 0 ] 127: then 128: retry_count=`expr $retry_count - 1` 129: /usr/bin/sleep $sleep_time 130: else 131: /usr/bin/rm -f $err_log_path/$dev.mount 132: result_flag=0 133: break 134: fi 135: done 136: 137: if [ $result_flag != 0 ] 138: then 139: exit 11 140: fi 141: fi 142: fi 143: # When devices of volume group can be unmounted --- 5 144: # elif [ "$dev_type" = "logical" ] 145: # then 146: # #Specify the name of volume group to mount 147: # if [ "$device" = "/dev/vgXX" ] 148: # then 149: # # Mount all logical volumes of the volume group 150: # fs="hfs" 151: # lvname="/dev/vgXX/XXXXX" 152: # lv_mount_point="/XX" 153: # 154: # /usr/bin/df -l $lvname > /dev/null 2>&1 155: # if [ $? != 0 ] 156: # then 157: # /usr/sbin/mount -F $fs $lvname $lv_mount_point 2>/dev/null 158: # if [ $? != 0 ] 159: # then 160: # retry_count=3 161: # sleep_time=1 162: # result_flag=1 163: # 164: # while [ $retry_count -gt 0 ] 165: # do 166: # /usr/sbin/mount -F $fs $lvname $lv_mount_point > $err_log_path/$dev.mount 2>&1 167: # if [ $? != 0 ] 168: # then 169: # retry_count=`expr $retry_count - 1` 170: # /usr/bin/sleep $sleep_time 171: # else 172: # rm -f $err_log_path/$dev.mount 173: # result_flag=0 174: # break 175: # fi 176: # done 177: # 178: # if [ $result_flag != 0 ] 179: # then 180: # exit 11 181: # fi 182: # fi 183: # fi 184: # fi 185: fi 186: /usr/bin/rm -rf $post_file 2> /dev/null 187: /usr/bin/rm -rf $fstype_file 2> /dev/null 188: exit 0 189: fi 190: 191: exit 0 |
RepDst.post(複写先ボリューム後処理のシェルスクリプト)
1: #!/bin/sh 2: 3: # AdvancedCopy Manager 4: # All Rights Reserved, Copyright FUJITSU LIMITED, 2002-2008 5: 6: # 7: # Post-processing of Replication(Destination) processing 8: # 9: # Argument: $1 Device name of Destination disk 10: # 11: # Error number 12: # 2: Argument error 13: # 11: mount error 14: # 30: VG configuration file not found error 15: # 31: vgcfgrestore error 16: # 12: fsck error 17: 18: # Argument check 19: case $# in 20: 1) 21: ;; 22: *) 23: exit 2 24: ;; 25: esac 26: 27: device=$1 28: 29: # Device type check 30: # Determination postprocessing file name 31: trans="`echo $device | /usr/bin/grep -e "/dev/dsk/" -e "/dev/disk/"`" 32: lvmtrans="`echo $device | /usr/bin/grep "/dev/"`" 33: vxpvtrans="`echo $device | /usr/bin/grep "/dev/vx/dmp/"`" 34: if [ "$trans" != "" ] 35: then 36: dev_type="physical" 37: # /dev/dsk/c?t?d? -> c?t?d? 38: dev="`echo $device | /usr/bin/sed -e "s/\/dev\/dsk\///" -e "s/\/dev\/disk\//_hppv_/"`" 39: post_file="/etc/opt/FJSVswsrp/"$SWSTGNODE"/data/DEFAULT/"$dev".dpre" 40: fstype_file="/etc/opt/FJSVswsrp/"$SWSTGNODE"/data/DEFAULT/"$dev".dfstype" 41: elif [ "$vxpvtrans" != "" ] 42: then 43: dev_type="vxvm_pv" 44: # /dev/vx/dmp/XXXX -> XXXX 45: dev="`echo $device | /usr/bin/awk -F\/ '{ print $5 }'`" 46: post_file="/etc/opt/FJSVswsrp/"$SWSTGNODE"/data/DEFAULT/"$dev".dpre" 47: fstype_file="/etc/opt/FJSVswsrp/"$SWSTGNODE"/data/DEFAULT/"$dev".dfstype" 48: elif [ "$lvmtrans" != "" ] 49: then 50: dev_type="logical" 51: # /dev/vgXX -> vgXX 52: dev="`echo $device | /usr/bin/awk -F\/ '{ print $3 }'`" 53: post_file="/etc/opt/FJSVswsrp/"$SWSTGNODE"/data/DEFAULT/"$dev".dpre" 54: fstype_file="/etc/opt/FJSVswsrp/"$SWSTGNODE"/data/DEFAULT/"$dev".dfstype" 55: else 56: exit 0 57: fi 58: 59: err_log_path="/var/opt/FJSVswsrp/"$SWSTGNODE"/log" 60: 61: # Confirmation of postprocessing 62: if [ ! -r $post_file ] 63: then 64: exit 0 65: fi 66: post="`/usr/bin/cat $post_file | /usr/bin/cut -d',' -f1`" 67: mount_point="`/usr/bin/cat $post_file | /usr/bin/cut -d',' -f2`" 68: 69: # Confirmation of FStype 70: if [ ! -r $fstype_file ] 71: then 72: fs="" 73: else 74: fs="`/usr/bin/cat $fstype_file`" 75: fi 76: 77: # Restore VG Configuration 78: if [ "$dev_type" = "logical" ] 79: then 80: vg_name="`echo $device | /usr/bin/awk -F\/ '{ print $3 }'`" 81: cfg_file="/etc/lvmconf/"$vg_name".conf" 82: if [ ! -r $cfg_file ] 83: then 84: exit 30 85: fi 86: pv_rname="`/usr/sbin/vgcfgrestore -n $vg_name -l 2> /dev/null | /usr/bin/awk '{print $1}' | /usr/bin/grep -e \"/dev/rdsk\" -e \"/dev/rdisk\"`" 87: if [ "$pv_rname" = "" ] 88: then 89: echo "/usr/sbin/vgcfgrestore -n $vg_name -l 2> /dev/null | /usr/bin/awk '{print $1}' | /usr/bin/grep -e \"/dev/rdsk\" -e \"/dev/rdisk\"" > $err_log_path/$dev.vgcfgrestore 2>&1 90: exit 31 91: fi 92: /usr/sbin/vgchange -a n $vg_name > /dev/null 2>&1 93: reststatus=0 94: for pv_rname1 in $pv_rname 95: do 96: /usr/sbin/vgcfgrestore -n $vg_name $pv_rname1 > /dev/null 2>&1 97: if [ $? = 0 ] 98: then 99: /usr/sbin/vgcfgrestore -n $vg_name $pv_rname1 > $err_log_path/$dev.vgcfgrestore 2>&1 100: if [ $? = 0 ] 101: then 102: reststatus=1 103: break 104: fi 105: fi 106: done 107: if [ "$SWSTGNODE" != "" ] 108: then 109: /usr/sbin/vgchange -c y $vg_name > /dev/null 2>&1 110: /usr/sbin/vgchange -a e $vg_name > /dev/null 2>&1 111: else 112: /usr/sbin/vgchange -a y $vg_name > /dev/null 2>&1 113: fi 114: if [ $reststatus = 0 ] 115: then 116: exit 31 117: fi 118: fi 119: 120: # No processing 121: if [ "$post" = "none" ] 122: then 123: # When Src device cannot be unmounted --- 1 124: # if [ "$device" = "/dev/dsk/cXtXdX" ] 125: # then 126: # rdevice="`echo $device | sed "s/\/dsk\//\/rdsk\//"`" 127: # src_fs=hfs 128: # fsck -F $src_fs -y $rdevice > /dev/null 2>&1 129: # if [ $? != 0 ] 130: # then 131: # exit 12 132: # fi 133: # fi 134: # 135: # When Src devices of volume group cannot be unmounted --- 4 136: # if [ "$device" = "/dev/vgXX" ] 137: # then 138: # rdevice="/dev/vgXX/XXXXX" 139: # src_fs=hfs 140: # fsck -F $src_fs -y $rdevice > /dev/null 2>&1 141: # if [ $? != 0 ] 142: # then 143: # exit 12 144: # fi 145: # fi 146: # When Src/Dst device was not mounted --- 3 147: # When Src/Dst devices of volume group was not mounted --- 6 148: # When Src/Dst devices is a VxVM physical volume --- 7 149: /usr/bin/rm -rf $post_file 2> /dev/null 150: /usr/bin/rm -rf $fstype_file 2> /dev/null 151: exit 0 152: fi 153: 154: # mount processing 155: if [ "$post" = "mount" ] 156: then 157: if [ "$dev_type" = "physical" ] 158: then 159: # When Dst device can be unmounted --- 2 160: /usr/bin/df -l $device > /dev/null 2>&1 161: if [ $? != 0 ] 162: then 163: if [ ! -r $fstype_file ] 164: then 165: /usr/sbin/mount $device $mount_point 2> /dev/null 166: else 167: if [ "$fs" = "" ] 168: then 169: /usr/sbin/mount $device $mount_point 2> /dev/null 170: else 171: /usr/sbin/mount -F $fs $device $mount_point 2> /dev/null 172: fi 173: fi 174: if [ $? != 0 ] 175: then 176: retry_count=3 177: sleep_time=1 178: result_flag=1 179: 180: while [ $retry_count -gt 0 ] 181: do 182: if [ ! -r $fstype_file ] 183: then 184: /usr/sbin/mount $device $mount_point > $err_log_path/$dev.mount 2>&1 185: else 186: if [ "$fs" = "" ] 187: then 188: /usr/sbin/mount $device $mount_point > $err_log_path/$dev.mount 2>&1 189: else 190: /usr/sbin/mount -F $fs $device $mount_point > $err_log_path/$dev.mount 2>&1 191: fi 192: fi 193: if [ $? != 0 ] 194: then 195: retry_count=`expr $retry_count - 1` 196: /usr/bin/sleep $sleep_time 197: else 198: /usr/bin/rm -f $err_log_path/$dev.mount 199: result_flag=0 200: break 201: fi 202: done 203: 204: if [ $result_flag != 0 ] 205: then 206: exit 11 207: fi 208: fi 209: fi 210: # elif [ "$dev_type" = "logical" ] 211: # then 212: # When Dst devices of volume group can be unmounted --- 5 213: # # Specify the name of volume group to mount 214: # if [ "$device" = "/dev/vgXX" ] 215: # then 216: # # Mount all logical volumes of the volume group 217: # fs="hfs" 218: # lvname="/dev/vgXX/XXXXX" 219: # lv_mount_point="/XX" 220: # 221: # /usr/bin/df -l $lvname > /dev/null 2>&1 222: # if [ $? != 0 ] 223: # then 224: # /usr/sbin/mount -F $fs $lvname $lv_mount_point 2>/dev/null 225: # if [ $? != 0 ] 226: # then 227: # retry_count=3 228: # sleep_time=1 229: # result_flag=1 230: # 231: # while [ $retry_count -gt 0 ] 232: # do 233: # /usr/sbin/mount -F $fs $lvname $lv_mount_point > $err_log_path/$dev.mount 2>&1 234: # if [ $? != 0 ] 235: # then 236: # retry_count=`expr $retry_count - 1` 237: # /usr/bin/sleep $sleep_time 238: # else 239: # rm -f $err_log_path/$dev.mount 240: # result_flag=0 241: # break 242: # fi 243: # done 244: # 245: # if [ $result_flag != 0 ] 246: # then 247: # exit 11 248: # fi 249: # fi 250: # fi 251: # fi 252: fi 253: /usr/bin/rm -rf $post_file 2> /dev/null 254: /usr/bin/rm -rf $fstype_file 2> /dev/null 255: exit 0 256: fi 257: 258: exit 0 |