後処理シェルスクリプトには、複写元ボリューム用(RepSrc.post)と複写先ボリューム用(RepDst.post)の2種類があり、それぞれのスクリプトは以下のディレクトリに格納されています。必要に応じて、カスタマイズしてください。
クラスタ運用でない場合
/etc/opt/FJSVswsrp/shディレクトリ |
クラスタ運用の場合
/etc/opt/FJSVswsrp/logicalNodeName/shディレクトリ |
複写元ボリューム用の後処理シェルスクリプト(RepSrc.post)
Red Hat Enterprise Linux 8、Red Hat Enterprise Linux 7、またはRed Hat Enterprise Linux 6の場合
1: #!/bin/sh 2: 3: # AdvancedCopy Manager 4: # Copyright FUJITSU LIMITED, 2002-2017 5: 6: # 7: # Postprocessing 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: unfreeze error 15: 16: # Argument check 17: case $# in 18: 1) 19: ;; 20: *) 21: exit 2 22: ;; 23: esac 24: 25: device=$1 26: 27: # Determination of postprocessing file name 28: if [ "`echo $device | /bin/grep "/dev/sd"`" != "" ] 29: then 30: # /dev/sd? -> sd? 31: dev="`echo $device | /bin/sed "s/\/dev\///"`" 32: elif [ "`echo $device | /bin/grep "/dev/vd"`" != "" ] 33: then 34: # /dev/vd? -> vd? 35: dev="`echo $device | /bin/sed "s/\/dev\///"`" 36: elif [ "`echo $device | /bin/grep "/dev/FJSV"`" != "" ] 37: then 38: # /dev/FJSVmphd/dsk/mplb?s? -> mplb?s? 39: # /dev/FJSVmphd/dsk/mphd?s? -> mphd?s? 40: dev="`echo $device | /bin/cut -d/ -f5`" 41: elif [ "`echo $device | /bin/grep "/dev/sfdsk/"`" != "" ] 42: then 43: if [ "`echo $device | /bin/grep ":"`" != "" ] 44: then 45: devnam="`echo $device | /bin/cut -d: -f2-`" 46: # /dev/sfdsk/class/dsk/volume:sd? -> class_volume_sd? 47: dev="`echo $device | /bin/sed "s/\/dev\/sfdsk\///"`" 48: dev="`echo $dev | /bin/sed "s/\/dsk\//_/"`" 49: dev="`echo $dev | /bin/sed "s/:/_/"`" 50: device="`echo $device | /bin/cut -d: -f1`" 51: if [ "`echo $devnam | /bin/grep "/dev/disk/by-id/"`" != "" ] 52: then 53: # /dev/sfdsk/class/dsk/volume:/dev/disk/by-id/<device> -> class_volume__by_id_<device> 54: dev="`echo $dev | /bin/sed "s/\/dev\/disk\/by-id\//_by-id_/"`" 55: elif [ "`echo $devnam | /bin/grep "/dev/disk/by-path/"`" != "" ] 56: then 57: # /dev/sfdsk/class/dsk/volume:/dev/disk/by-path/<device> -> class_volume__by_path_<device> 58: dev="`echo $dev | /bin/sed "s/\/dev\/disk\/by-path\//_by-path_/"`" 59: fi 60: else 61: # /dev/sfdsk/class/dsk/volume -> _gds_class_volume 62: dev="_gds_`echo $device | /bin/sed "s/\/dev\/sfdsk\///"`" 63: dev="`echo $dev | /bin/sed "s/\/dsk\//_/"`" 64: fi 65: elif [ "`echo $device | /bin/grep "/dev/vx/dmp/"`" != "" ] 66: then 67: # /dev/vx/dmp/device -> _vx_pv_device 68: dev="_vx_pv_`echo $device | /bin/sed "s/\/dev\/vx\/dmp\///"`" 69: elif [ "`echo $device | /bin/grep "/dev/mapper/"`" != "" ] 70: then 71: # "/dev/mapper/<device>" -> "_mapper_<device>" 72: dev="_mapper_`echo $device | /bin/sed "s/\/dev\/mapper\///"`" 73: elif [ "`echo $device | /bin/grep "/dev/disk/by-id/"`" != "" ] 74: then 75: # "/dev/disk/by-id/<device>" -> "_by-id_<device>" 76: dev="_by-id_`echo $device | /bin/sed "s/\/dev\/disk\/by-id\///"`" 77: elif [ "`echo $device | /bin/grep "/dev/disk/by-path/"`" != "" ] 78: then 79: # "/dev/disk/by-path/<device>" -> "_by-path_<device>" 80: dev="_by-path_`echo $device | /bin/sed "s/\/dev\/disk\/by-path\///"`" 81: else 82: exit 0 83: fi 84: post_file="/etc/opt/FJSVswsrp/"$SWSTGNODE"/data/DEFAULT/"$dev".spre" 85: fstype_file="/etc/opt/FJSVswsrp/"$SWSTGNODE"/data/DEFAULT/"$dev".sfstype" 86: 87: err_log_path="/var/opt/FJSVswsrp/"$SWSTGNODE"/log" 88: 89: # Confirmation of postprocessing 90: if [ ! -r $post_file ] 91: then 92: exit 0 93: fi 94: post="`/bin/cat $post_file | /bin/cut -d',' -f1`" 95: mount_point="`/bin/cat $post_file | /bin/cut -d',' -f2`" 96: 97: # Confirmation of FStype 98: if [ ! -r $fstype_file ] 99: then 100: fs="" 101: else 102: fs="`/bin/cat $fstype_file`" 103: fi 104: 105: # No processing 106: if [ "$post" = "none" ] 107: then 108: /bin/rm -rf $post_file 2> /dev/null 109: /bin/rm -rf $fstype_file 2> /dev/null 110: exit 0 111: fi 112: 113: # mount processing 114: if [ "$post" = "mount" ] 115: then 116: if [ "`echo $device | /bin/grep "/dev/disk/by-id/"`" != "" \ 117: -o "`echo $device | /bin/grep "/dev/disk/by-path/"`" != "" ] 118: then 119: cdevice="/dev/`/usr/bin/readlink $device | /bin/sed "s/..\/..\///"`" 120: Result="`/bin/df -l | /bin/grep "$cdevice " | /bin/awk 'END {print NR}'`" 121: else 122: Result="`/bin/df -l | /bin/grep "$device " | /bin/awk 'END {print NR}'`" 123: fi 124: if [ "$Result" != "1" ] 125: then 126: if [ ! -r $fstype_file ] 127: then 128: /bin/mount $device $mount_point 2> /dev/null 129: else 130: Result1="`echo $fs | /bin/awk 'END {print NR}'`" 131: if [ "$Result1" != "1" ] 132: then 133: /bin/mount $device $mount_point 2> /dev/null 134: else 135: /bin/mount -t $fs $device $mount_point 2> /dev/null 136: fi 137: fi 138: if [ $? != 0 ] 139: then 140: retry_count=3 141: sleep_time=1 142: result_flag=1 143: 144: while [ $retry_count -gt 0 ] 145: do 146: if [ ! -r $fstype_file ] 147: then 148: /bin/mount $device $mount_point > $err_log_path/$dev.mount 2>&1 149: else 150: Result1="`echo $fs | /bin/awk 'END {print NR}'`" 151: if [ "$Result1" != "1" ] 152: then 153: /bin/mount $device $mount_point > $err_log_path/$dev.mount 2>&1 154: else 155: /bin/mount -t $fs $device $mount_point > $err_log_path/$dev.mount 2>&1 156: fi 157: fi 158: if [ $? != 0 ] 159: then 160: retry_count=`expr $retry_count - 1` 161: /bin/sleep $sleep_time 162: else 163: /bin/rm -f $err_log_path/$dev.mount 164: result_flag=0 165: break 166: fi 167: done 168: 169: if [ $result_flag != 0 ] 170: then 171: exit 11 172: fi 173: fi 174: fi 175: /bin/rm -rf $post_file 2> /dev/null 176: /bin/rm -rf $fstype_file 2> /dev/null 177: exit 0 178: fi 179: 180: #fsfreeze processing 181: if [ "$post" = "fsfreeze" ] 182: then 183: result="`/sbin/fsfreeze -u $mount_point 2>&1 `" 184: if [ $? != 0 ] 185: then 186: echo "$result" > $err_log_path/$dev.fsfreeze 187: exit 15 188: fi 189: /bin/rm -rf $post_file 2> /dev/null 190: /bin/rm -rf $fstype_file 2> /dev/null 191: exit 0 192: fi 193: 194: exit 0
SUSE Linux Enterprise Server 15またはSUSE Linux Enterprise Server 12の場合
1: #!/bin/sh 2: 3: # AdvancedCopy Manager 4: # All Rights Reserved, Copyright FUJITSU LIMITED, 2002-2011 5: 6: # 7: # Postprocessing 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: # Determination of postprocessing file name 27: if [ "`echo $device | /bin/grep "/dev/sd"`" != "" ] 28: then 29: # /dev/sd? -> sd? 30: dev="`echo $device | /bin/sed "s/\/dev\///"`" 31: elif [ "`echo $device | /bin/grep "/dev/FJSV"`" != "" ] 32: then 33: # /dev/FJSVmphd/dsk/mplb?s? -> mplb?s? 34: # /dev/FJSVmphd/dsk/mphd?s? -> mphd?s? 35: dev="`echo $device | /usr/bin/cut -d/ -f5`" 36: elif [ "`echo $device | /bin/grep "/dev/sfdsk/"`" != "" ] 37: then 38: if [ "`echo $device | /bin/grep ":"`" != "" ] 39: then 40: devnam="`echo $device | /usr/bin/cut -d: -f2-`" 41: # /dev/sfdsk/class/dsk/volume:sd? -> class_volume_sd? 42: dev="`echo $device | /bin/sed "s/\/dev\/sfdsk\///"`" 43: dev="`echo $dev | /bin/sed "s/\/dsk\//_/"`" 44: dev="`echo $dev | /bin/sed "s/:/_/"`" 45: device="`echo $device | /usr/bin/cut -d: -f1`" 46: if [ "`echo $devnam | /bin/grep "/dev/disk/by-id/"`" != "" ] 47: then 48: # /dev/sfdsk/class/dsk/volume:/dev/disk/by-id/<device> -> class_volume__by_id_<device> 49: dev="`echo $dev | /bin/sed "s/\/dev\/disk\/by-id\//_by-id_/"`" 50: elif [ "`echo $devnam | /bin/grep "/dev/disk/by-path/"`" != "" ] 51: then 52: # /dev/sfdsk/class/dsk/volume:/dev/disk/by-path/<device> -> class_volume__by_path_<device> 53: dev="`echo $dev | /bin/sed "s/\/dev\/disk\/by-path\//_by-path_/"`" 54: fi 55: else 56: # /dev/sfdsk/class/dsk/volume -> _gds_class_volume 57: dev="_gds_`echo $device | /bin/sed "s/\/dev\/sfdsk\///"`" 58: dev="`echo $dev | /bin/sed "s/\/dsk\//_/"`" 59: fi 60: elif [ "`echo $device | /bin/grep "/dev/vx/dmp/"`" != "" ] 61: then 62: # /dev/vx/dmp/device -> _vx_pv_device 63: dev="_vx_pv_`echo $device | /bin/sed "s/\/dev\/vx\/dmp\///"`" 64: elif [ "`echo $device | /bin/grep "/dev/mapper/"`" != "" ] 65: then 66: # "/dev/mapper/<device>" -> "_mapper_<device>" 67: dev="_mapper_`echo $device | /bin/sed "s/\/dev\/mapper\///"`" 68: elif [ "`echo $device | /bin/grep "/dev/disk/by-id/"`" != "" ] 69: then 70: # "/dev/disk/by-id/<device>" -> "_by-id_<device>" 71: dev="_by-id_`echo $device | /bin/sed "s/\/dev\/disk\/by-id\///"`" 72: elif [ "`echo $device | /bin/grep "/dev/disk/by-path/"`" != "" ] 73: then 74: # "/dev/disk/by-path/<device>" -> "_by-path_<device>" 75: dev="_by-path_`echo $device | /bin/sed "s/\/dev\/disk\/by-path\///"`" 76: else 77: exit 0 78: fi 79: post_file="/etc/opt/FJSVswsrp/"$SWSTGNODE"/data/DEFAULT/"$dev".spre" 80: fstype_file="/etc/opt/FJSVswsrp/"$SWSTGNODE"/data/DEFAULT/"$dev".sfstype" 81: 82: err_log_path="/var/opt/FJSVswsrp/"$SWSTGNODE"/log" 83: 84: # Confirmation of postprocessing 85: if [ ! -r $post_file ] 86: then 87: exit 0 88: fi 89: post="`/bin/cat $post_file | /usr/bin/cut -d',' -f1`" 90: mount_point="`/bin/cat $post_file | /usr/bin/cut -d',' -f2`" 91: 92: # Confirmation of FStype 93: if [ ! -r $fstype_file ] 94: then 95: fs="" 96: else 97: fs="`/bin/cat $fstype_file`" 98: fi 99: 100: # No processing 101: if [ "$post" = "none" ] 102: then 103: /bin/rm -rf $post_file 2> /dev/null 104: /bin/rm -rf $fstype_file 2> /dev/null 105: exit 0 106: fi 107: 108: # mount processing 109: if [ "$post" = "mount" ] 110: then 111: if [ "`echo $device | /bin/grep "/dev/disk/by-id/"`" != "" \ 112: -o "`echo $device | /bin/grep "/dev/disk/by-path/"`" != "" ] 113: then 114: cdevice="/dev/`/usr/bin/readlink $device | /bin/sed "s/..\/..\///"`" 115: Result="`/bin/df -l | /bin/grep "$cdevice " | /bin/awk 'END {print NR}'`" 116: else 117: Result="`/bin/df -l | /bin/grep "$device " | /bin/awk 'END {print NR}'`" 118: fi 119: if [ "$Result" != "1" ] 120: then 121: if [ ! -r $fstype_file ] 122: then 123: /bin/mount $device $mount_point 2> /dev/null 124: else 125: Result1="`echo $fs | /bin/awk 'END {print NR}'`" 126: if [ "$Result1" != "1" ] 127: then 128: /bin/mount $device $mount_point 2> /dev/null 129: else 130: /bin/mount -t $fs $device $mount_point 2> /dev/null 131: fi 132: fi 133: if [ $? != 0 ] 134: then 135: retry_count=3 136: sleep_time=1 137: result_flag=1 138: 139: while [ $retry_count -gt 0 ] 140: do 141: if [ ! -r $fstype_file ] 142: then 143: /bin/mount $device $mount_point > $err_log_path/$dev.mount 2>&1 144: else 145: Result1="`echo $fs | /bin/awk 'END {print NR}'`" 146: if [ "$Result1" != "1" ] 147: then 148: /bin/mount $device $mount_point > $err_log_path/$dev.mount 2>&1 149: else 150: /bin/mount -t $fs $device $mount_point > $err_log_path/$dev.mount 2>&1 151: fi 152: fi 153: if [ $? != 0 ] 154: then 155: retry_count=`expr $retry_count - 1` 156: /bin/sleep $sleep_time 157: else 158: /bin/rm -f $err_log_path/$dev.mount 159: result_flag=0 160: break 161: fi 162: done 163: 164: if [ $result_flag != 0 ] 165: then 166: exit 11 167: fi 168: fi 169: fi 170: /bin/rm -rf $post_file 2> /dev/null 171: /bin/rm -rf $fstype_file 2> /dev/null 172: exit 0 173: fi 174: 175: exit 0
複写先ボリューム用の後処理シェルスクリプト(RepDst.post)
Red Hat Enterprise Linux 8、Red Hat Enterprise Linux 7、またはRed Hat Enterprise Linux 6の場合
1: #!/bin/sh 2: 3: # AdvancedCopy Manager 4: # Copyright FUJITSU LIMITED 2002-2017 5: 6: # 7: # Postprocessing 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: 15: # Argument check 16: case $# in 17: 1) 18: ;; 19: *) 20: exit 2 21: ;; 22: esac 23: 24: device=$1 25: 26: # Determination of postprocessing file name 27: if [ "`echo $device | /bin/grep "/dev/sd"`" != "" ] 28: then 29: # /dev/sd? -> sd? 30: dev="`echo $device | /bin/sed "s/\/dev\///"`" 31: elif [ "`echo $device | /bin/grep "/dev/vd"`" != "" ] 32: then 33: # /dev/vd? -> vd? 34: dev="`echo $device | /bin/sed "s/\/dev\///"`" 35: elif [ "`echo $device | /bin/grep "/dev/FJSV"`" != "" ] 36: then 37: # /dev/FJSVmphd/dsk/mplb?s? -> mplb?s? 38: # /dev/FJSVmphd/dsk/mphd?s? -> mphd?s? 39: dev="`echo $device | /bin/cut -d/ -f5`" 40: elif [ "`echo $device | /bin/grep "/dev/sfdsk/"`" != "" ] 41: then 42: if [ "`echo $device | /bin/grep ":"`" != "" ] 43: then 44: devnam="`echo $device | /bin/cut -d: -f2-`" 45: # /dev/sfdsk/class/dsk/volume:sd? -> class_volume_sd? 46: dev="`echo $device | /bin/sed "s/\/dev\/sfdsk\///"`" 47: dev="`echo $dev | /bin/sed "s/\/dsk\//_/"`" 48: dev="`echo $dev | /bin/sed "s/:/_/"`" 49: device="`echo $device | /bin/cut -d: -f1`" 50: if [ "`echo $devnam | /bin/grep "/dev/disk/by-id/"`" != "" ] 51: then 52: # /dev/sfdsk/class/dsk/volume:/dev/disk/by-id/<device> -> class_volume__by_id_<device> 53: dev="`echo $dev | /bin/sed "s/\/dev\/disk\/by-id\//_by-id_/"`" 54: elif [ "`echo $devnam | /bin/grep "/dev/disk/by-path/"`" != "" ] 55: then 56: # /dev/sfdsk/class/dsk/volume:/dev/disk/by-path/<device> -> class_volume__by_path_<device> 57: dev="`echo $dev | /bin/sed "s/\/dev\/disk\/by-path\//_by-path_/"`" 58: fi 59: else 60: # /dev/sfdsk/class/dsk/volume -> _gds_class_volume 61: dev="_gds_`echo $device | /bin/sed "s/\/dev\/sfdsk\///"`" 62: dev="`echo $dev | /bin/sed "s/\/dsk\//_/"`" 63: fi 64: elif [ "`echo $device | /bin/grep "/dev/vx/dmp/"`" != "" ] 65: then 66: # /dev/vx/dmp/device -> _vx_pv_device 67: dev="_vx_pv_`echo $device | /bin/sed "s/\/dev\/vx\/dmp\///"`" 68: elif [ "`echo $device | /bin/grep "/dev/mapper/"`" != "" ] 69: then 70: # "/dev/mapper/<device>" -> "_mapper_<device>" 71: dev="_mapper_`echo $device | /bin/sed "s/\/dev\/mapper\///"`" 72: elif [ "`echo $device | /bin/grep "/dev/disk/by-id/"`" != "" ] 73: then 74: # "/dev/disk/by-id/<device>" -> "_by-id_<device>" 75: dev="_by-id_`echo $device | /bin/sed "s/\/dev\/disk\/by-id\///"`" 76: elif [ "`echo $device | /bin/grep "/dev/disk/by-path/"`" != "" ] 77: then 78: # "/dev/disk/by-path/<device>" -> "_by-path_<device>" 79: dev="_by-path_`echo $device | /bin/sed "s/\/dev\/disk\/by-path\///"`" 80: else 81: exit 0 82: fi 83: post_file="/etc/opt/FJSVswsrp/"$SWSTGNODE"/data/DEFAULT/"$dev".dpre" 84: fstype_file="/etc/opt/FJSVswsrp/"$SWSTGNODE"/data/DEFAULT/"$dev".dfstype" 85: 86: err_log_path="/var/opt/FJSVswsrp/"$SWSTGNODE"/log" 87: 88: # Confirmation of postprocessing 89: if [ ! -r $post_file ] 90: then 91: exit 0 92: fi 93: post="`/bin/cat $post_file | /bin/cut -d',' -f1`" 94: mount_point="`/bin/cat $post_file | /bin/cut -d',' -f2`" 95: 96: # Confirmation of FStype 97: if [ ! -r $fstype_file ] 98: then 99: fs="" 100: else 101: fs="`/bin/cat $fstype_file`" 102: fi 103: 104: # When source device cannot be unmounted, fsck for destination device is needed 105: # 106: #if [ "$device" = "/dev/sdX" -o "$device" = "/dev/sdY" ] 107: #then 108: # fsck_dev="`echo $device`" 109: # 110: # if [ ! -r $fstype_file ] 111: # then 112: # /sbin/fsck -n $fsck_dev > /dev/null 2>&1 113: # else 114: # if [ "$fs" = "" ] 115: # then 116: # /sbin/fsck -n $fsck_dev > /dev/null 2>&1 117: # else 118: # /sbin/fsck -n -t $fs $fsck_dev > /dev/null 2>&1 119: # fi 120: # fi 121: # if [ $? != 0 ] 122: # then 123: # if [ "$fs" = "" ] 124: # then 125: # result="`/sbin/fsck -p $fsck_dev 2>&1 `" 126: # else 127: # result="`/sbin/fsck -p -t $fs $fsck_dev 2>&1 `" 128: # fi 129: # fsck_rc=$? 130: # if [ $fsck_rc != 0 ] && [ $fsck_rc != 1 ] 131: # then 132: # echo "$result" > $err_log_path/$dev.fsck 133: # exit 12 134: # fi 135: # fi 136: #fi 137: 138: # No processing 139: if [ "$post" = "none" ] 140: then 141: /bin/rm -rf $post_file 2> /dev/null 142: /bin/rm -rf $fstype_file 2> /dev/null 143: exit 0 144: fi 145: 146: # mount processing 147: if [ "$post" = "mount" ] 148: then 149: # df -l $device > /dev/null 2>&1 150: # if [ $? != 0 ] 151: if [ "`echo $device | /bin/grep "/dev/disk/by-id/"`" != "" \ 152: -o "`echo $device | /bin/grep "/dev/disk/by-path/"`" != "" ] 153: then 154: cdevice="/dev/`/usr/bin/readlink $device | /bin/sed "s/..\/..\///"`" 155: Result="`/bin/df -l | /bin/grep "$cdevice " | /bin/awk 'END {print NR}'`" 156: else 157: Result="`/bin/df -l | /bin/grep "$device " | /bin/awk 'END {print NR}'`" 158: fi 159: if [ "$Result" != "1" ] 160: then 161: if [ ! -r $fstype_file ] 162: then 163: /bin/mount $device $mount_point 2> /dev/null 164: else 165: Result1="`echo $fs | /bin/awk 'END {print NR}'`" 166: if [ "$Result1" != "1" ] 167: then 168: /bin/mount $device $mount_point 2> /dev/null 169: else 170: if [ "$fs" = "xfs" ] 171: then 172: /bin/mount -o nouuid $device $mount_point 2> /dev/null 173: else 174: /bin/mount -t $fs $device $mount_point 2> /dev/null 175: fi 176: fi 177: fi 178: if [ $? != 0 ] 179: then 180: retry_count=3 181: sleep_time=1 182: result_flag=1 183: 184: while [ $retry_count -gt 0 ] 185: do 186: if [ ! -r $fstype_file ] 187: then 188: /bin/mount $device $mount_point > $err_log_path/$dev.mount 2>&1 189: else 190: Result1="`echo $fs | /bin/awk 'END {print NR}'`" 191: if [ "$Result1" != "1" ] 192: then 193: /bin/mount $device $mount_point > $err_log_path/$dev.mount 2>&1 194: else 195: if [ "$fs" = "xfs" ] 196: then 197: /bin/mount -o nouuid $device $mount_point > $err_log_path/$dev.mount 2>&1 198: else 199: /bin/mount -t $fs $device $mount_point > $err_log_path/$dev.mount 2>&1 200: fi 201: fi 202: fi 203: if [ $? != 0 ] 204: then 205: retry_count=`expr $retry_count - 1` 206: /bin/sleep $sleep_time 207: else 208: /bin/rm -f $err_log_path/$dev.mount 209: result_flag=0 210: break 211: fi 212: done 213: 214: if [ $result_flag != 0 ] 215: then 216: exit 11 217: fi 218: fi 219: fi 220: /bin/rm -rf $post_file 2> /dev/null 221: /bin/rm -rf $fstype_file 2> /dev/null 222: exit 0 223: fi 224: 225: exit 0
SUSE Linux Enterprise Server 15またはSUSE Linux Enterprise Server 12の場合
1: #!/bin/sh 2: 3: # AdvancedCopy Manager 4: # Copyright FUJITSU LIMITED 2017 5: 6: # 7: # Postprocessing 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: 15: # Argument check 16: case $# in 17: 1) 18: ;; 19: *) 20: exit 2 21: ;; 22: esac 23: 24: device=$1 25: 26: # Determination of postprocessing file name 27: if [ "`echo $device | /bin/grep "/dev/sd"`" != "" ] 28: then 29: # /dev/sd? -> sd? 30: dev="`echo $device | /bin/sed "s/\/dev\///"`" 31: elif [ "`echo $device | /bin/grep "/dev/FJSV"`" != "" ] 32: then 33: # /dev/FJSVmphd/dsk/mplb?s? -> mplb?s? 34: # /dev/FJSVmphd/dsk/mphd?s? -> mphd?s? 35: dev="`echo $device | /usr/bin/cut -d/ -f5`" 36: elif [ "`echo $device | /bin/grep "/dev/sfdsk/"`" != "" ] 37: then 38: if [ "`echo $device | /bin/grep ":"`" != "" ] 39: then 40: devnam="`echo $device | /usr/bin/cut -d: -f2-`" 41: # /dev/sfdsk/class/dsk/volume:sd? -> class_volume_sd? 42: dev="`echo $device | /bin/sed "s/\/dev\/sfdsk\///"`" 43: dev="`echo $dev | /bin/sed "s/\/dsk\//_/"`" 44: dev="`echo $dev | /bin/sed "s/:/_/"`" 45: device="`echo $device | /usr/bin/cut -d: -f1`" 46: if [ "`echo $devnam | /bin/grep "/dev/disk/by-id/"`" != "" ] 47: then 48: # /dev/sfdsk/class/dsk/volume:/dev/disk/by-id/<device> -> class_volume__by_id_<device> 49: dev="`echo $dev | /bin/sed "s/\/dev\/disk\/by-id\//_by-id_/"`" 50: elif [ "`echo $devnam | /bin/grep "/dev/disk/by-path/"`" != "" ] 51: then 52: # /dev/sfdsk/class/dsk/volume:/dev/disk/by-path/<device> -> class_volume__by_path_<device> 53: dev="`echo $dev | /bin/sed "s/\/dev\/disk\/by-path\//_by-path_/"`" 54: fi 55: else 56: # /dev/sfdsk/class/dsk/volume -> _gds_class_volume 57: dev="_gds_`echo $device | /bin/sed "s/\/dev\/sfdsk\///"`" 58: dev="`echo $dev | /bin/sed "s/\/dsk\//_/"`" 59: fi 60: elif [ "`echo $device | /bin/grep "/dev/vx/dmp/"`" != "" ] 61: then 62: # /dev/vx/dmp/device -> _vx_pv_device 63: dev="_vx_pv_`echo $device | /bin/sed "s/\/dev\/vx\/dmp\///"`" 64: elif [ "`echo $device | /bin/grep "/dev/mapper/"`" != "" ] 65: then 66: # "/dev/mapper/<device>" -> "_mapper_<device>" 67: dev="_mapper_`echo $device | /bin/sed "s/\/dev\/mapper\///"`" 68: elif [ "`echo $device | /bin/grep "/dev/disk/by-id/"`" != "" ] 69: then 70: # "/dev/disk/by-id/<device>" -> "_by-id_<device>" 71: dev="_by-id_`echo $device | /bin/sed "s/\/dev\/disk\/by-id\///"`" 72: elif [ "`echo $device | /bin/grep "/dev/disk/by-path/"`" != "" ] 73: then 74: # "/dev/disk/by-path/<device>" -> "_by-path_<device>" 75: dev="_by-path_`echo $device | /bin/sed "s/\/dev\/disk\/by-path\///"`" 76: else 77: exit 0 78: fi 79: post_file="/etc/opt/FJSVswsrp/"$SWSTGNODE"/data/DEFAULT/"$dev".dpre" 80: fstype_file="/etc/opt/FJSVswsrp/"$SWSTGNODE"/data/DEFAULT/"$dev".dfstype" 81: 82: err_log_path="/var/opt/FJSVswsrp/"$SWSTGNODE"/log" 83: 84: # Confirmation of postprocessing 85: if [ ! -r $post_file ] 86: then 87: exit 0 88: fi 89: post="`/bin/cat $post_file | /usr/bin/cut -d',' -f1`" 90: mount_point="`/bin/cat $post_file | /usr/bin/cut -d',' -f2`" 91: 92: # Confirmation of FStype 93: if [ ! -r $fstype_file ] 94: then 95: fs="" 96: else 97: fs="`/bin/cat $fstype_file`" 98: fi 99: 100: # When source device cannot be unmounted, fsck for destination device is needed 101: # 102: #if [ "$device" = "/dev/sdX" -o "$device" = "/dev/sdY" ] 103: #then 104: # fsck_dev="`echo $device`" 105: # 106: # if [ ! -r $fstype_file ] 107: # then 108: # /sbin/fsck -n $fsck_dev > /dev/null 2>&1 109: # else 110: # if [ "$fs" = "" ] 111: # then 112: # /sbin/fsck -n $fsck_dev > /dev/null 2>&1 113: # else 114: # /sbin/fsck -n -t $fs $fsck_dev > /dev/null 2>&1 115: # fi 116: # fi 117: # if [ $? != 0 ] 118: # then 119: # if [ "$fs" = "" ] 120: # then 121: # result="`/sbin/fsck -p $fsck_dev 2>&1 `" 122: # else 123: # result="`/sbin/fsck -p -t $fs $fsck_dev 2>&1 `" 124: # fi 125: # fsck_rc=$? 126: # if [ $fsck_rc != 0 ] && [ $fsck_rc != 1 ] 127: # then 128: # echo "$result" > $err_log_path/$dev.fsck 129: # exit 12 130: # fi 131: # fi 132: #fi 133: 134: # No processing 135: if [ "$post" = "none" ] 136: then 137: /bin/rm -rf $post_file 2> /dev/null 138: /bin/rm -rf $fstype_file 2> /dev/null 139: exit 0 140: fi 141: 142: # mount processing 143: if [ "$post" = "mount" ] 144: then 145: # df -l $device > /dev/null 2>&1 146: # if [ $? != 0 ] 147: if [ "`echo $device | /bin/grep "/dev/disk/by-id/"`" != "" \ 148: -o "`echo $device | /bin/grep "/dev/disk/by-path/"`" != "" ] 149: then 150: cdevice="/dev/`/usr/bin/readlink $device | /bin/sed "s/..\/..\///"`" 151: Result="`/bin/df -l | /bin/grep "$cdevice " | /bin/awk 'END {print NR}'`" 152: else 153: Result="`/bin/df -l | /bin/grep "$device " | /bin/awk 'END {print NR}'`" 154: fi 155: if [ "$Result" != "1" ] 156: then 157: if [ ! -r $fstype_file ] 158: then 159: /bin/mount $device $mount_point 2> /dev/null 160: else 161: Result1="`echo $fs | /bin/awk 'END {print NR}'`" 162: if [ "$Result1" != "1" ] 163: then 164: /bin/mount $device $mount_point 2> /dev/null 165: else 166: if [ "$fs" = "xfs" ] 167: then 168: /bin/mount -o nouuid $device $mount_point 2> /dev/null 169: else 170: /bin/mount -t $fs $device $mount_point 2> /dev/null 171: fi 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: /bin/mount $device $mount_point > $err_log_path/$dev.mount 2>&1 185: else 186: Result1="`echo $fs | /bin/awk 'END {print NR}'`" 187: if [ "$Result1" != "1" ] 188: then 189: /bin/mount $device $mount_point > $err_log_path/$dev.mount 2>&1 190: else 191: if [ "$fs" = "xfs" ] 192: then 193: /bin/mount -o nouuid $device $mount_point > $err_log_path/$dev.mount 2>&1 194: else 195: /bin/mount -t $fs $device $mount_point > $err_log_path/$dev.mount 2>&1 196: fi 197: fi 198: fi 199: if [ $? != 0 ] 200: then 201: retry_count=`expr $retry_count - 1` 202: /bin/sleep $sleep_time 203: else 204: /bin/rm -f $err_log_path/$dev.mount 205: result_flag=0 206: break 207: fi 208: done 209: 210: if [ $result_flag != 0 ] 211: then 212: exit 11 213: fi 214: fi 215: fi 216: /bin/rm -rf $post_file 2> /dev/null 217: /bin/rm -rf $fstype_file 2> /dev/null 218: exit 0 219: fi 220: 221: exit 0