バックアップ実行時の前処理のシェルスクリプト名は、以下のとおりです。
クラスタ運用でない場合
/etc/opt/FJSVswsts/sh/OpcBackup.pre |
クラスタ運用の場合
/etc/opt/FJSVswsts/logicalNodeName/sh/OpcBackup.pre |
バックアップ時の前処理シェルスクリプト(OpcBackup.pre)
RHEL5/RHEL6/RHEL7の場合
1: #!/bin/sh 2: 3: # AdvancedCopy Manager 4: # Copyright FUJITSU LIMITED, 2002-2017 5: 6: # 7: # Preprocessing of backup processing 8: # 9: # Argument: $1 Device name of transaction disk 10: # $2 Mount point of transaction disk 11: # $3 Device name of backup disk 12: # 13: # Error number 14: # 2: Argument error 15: # 10: umount error 16: # 13: Illegal mount type (bind/stack mount) 17: # 14: fsfreeze error 18: 19: 20: # Argument check 21: case $# in 22: 1) 23: ;; 24: 2) 25: ;; 26: 3) 27: ;; 28: *) 29: exit 2 30: ;; 31: esac 32: 33: device="`echo $1`" 34: mount_point="`echo $2`" 35: bk_device="`echo $3`" 36: 37: # Determination postprocessing file name 38: 39: if [ "$SWSTGNODE" != "" ] 40: then 41: swstg_node="/`echo $SWSTGNODE`" 42: else 43: swstg_node="" 44: fi 45: 46: err_log_path="/var/opt/FJSVswsts"$swstg_node"/log" 47: 48: if [ "`echo $device | /bin/grep "/dev/sd"`" != "" ] 49: then 50: # /dev/sd? -> sd? 51: dev="`echo $device | /bin/sed "s/\/dev\///"`" 52: elif [ "`echo $device | /bin/grep "/dev/vd"`" != "" ] 53: then 54: # /dev/vd? -> vd? 55: dev="`echo $device | /bin/sed "s/\/dev\///"`" 56: elif [ "`echo $device | /bin/grep "/dev/FJSV"`" != "" ] 57: then 58: # /dev/FJSVmphd/dsk/mplb?s? -> mplb?s? 59: # /dev/FJSVmphd/dsk/mphd?s? -> mphd?s? 60: dev="`echo $device | /bin/cut -d/ -f5`" 61: elif [ "`echo $device | /bin/grep "/dev/sfdsk/"`" != "" ] 62: then 63: if [ "`echo $device | /bin/grep ":"`" != "" ] 64: then 65: devnam="`echo $device | /bin/cut -d: -f2-`" 66: # /dev/sfdsk/class/dsk/volume:sd? -> class_volume_sd? 67: dev="`echo $device | /bin/sed "s/\/dev\/sfdsk\///"`" 68: dev="`echo $dev | /bin/sed "s/\/dsk\//_/"`" 69: dev="`echo $dev | /bin/sed "s/:/_/"`" 70: device="`echo $device | /bin/cut -d: -f1`" 71: if [ "`echo $devnam | /bin/grep "/dev/disk/by-id/"`" != "" ] 72: then 73: # /dev/sfdsk/class/dsk/volume:/dev/disk/by-id/<device> -> class_volume__by_id_<device> 74: dev="`echo $dev | /bin/sed "s/\/dev\/disk\/by-id\//_by-id_/"`" 75: elif [ "`echo $devnam | /bin/grep "/dev/disk/by-path/"`" != "" ] 76: then 77: # /dev/sfdsk/class/dsk/volume:/dev/disk/by-path/<device> -> class_volume__by_path_<device> 78: dev="`echo $dev | /bin/sed "s/\/dev\/disk\/by-path\//_by-path_/"`" 79: fi 80: else 81: # /dev/sfdsk/class/dsk/volume -> _gds_class_volume 82: dev="_gds_`echo $device | /bin/sed "s/\/dev\/sfdsk\///"`" 83: dev="`echo $dev | /bin/sed "s/\/dsk\//_/"`" 84: fi 85: elif [ "`echo $device | /bin/grep "/dev/vx/dmp/"`" != "" ] 86: then 87: # /dev/vx/dmp/device -> _vx_pv_device 88: dev="_vx_pv_`echo $device | /bin/sed "s/\/dev\/vx\/dmp\///"`" 89: elif [ "`echo $device | /bin/grep "/dev/mapper/"`" != "" ] 90: then 91: # "/dev/mapper/<device>" -> "_mapper_<device>" 92: dev="_mapper_`echo $device | /bin/sed "s/\/dev\/mapper\///"`" 93: elif [ "`echo $device | /bin/grep "/dev/disk/by-id/"`" != "" ] 94: then 95: # "/dev/disk/by-id/<device>" -> "_by-id_<device>" 96: dev="_by-id_`echo $device | /bin/sed "s/\/dev\/disk\/by-id\///"`" 97: elif [ "`echo $device | /bin/grep "/dev/disk/by-path/"`" != "" ] 98: then 99: # "/dev/disk/by-path/<device>" -> "_by-path_<device>" 100: dev="_by-path_`echo $device | /bin/sed "s/\/dev\/disk\/by-path\///"`" 101: else 102: exit 0 103: fi 104: post_file="/etc/opt/FJSVswsts"$swstg_node"/data/DEFAULT/"$dev".pre" 105: fstype_file="/etc/opt/FJSVswsts"$swstg_node"/data/DEFAULT/"$dev".fstype" 106: bd_file="/etc/opt/FJSVswsts"$swstg_node"/data/DEFAULT/"$dev".bd" 107: 108: if [ "$mount_point" != "" ] 109: then 110: 111: proc="" 112: # When device cannot be unmounted (sync) 113: # 114: # if [ "$device" = "/dev/sdX" -o "$device" = "/dev/sdY" ] 115: # then 116: # proc="sync" 117: # if [ "$bk_device" != "" ] 118: # then 119: # echo $bk_device > $bd_file 120: # fi 121: # /bin/awk "\$2==\"$mount_point\" {print \$3}" /proc/mounts > $fstype_file 122: # /bin/sync 123: # /bin/sync 124: # /bin/sync 125: # echo "fsck" > $post_file 126: # fi 127: 128: # When device cannot be unmounted (fsfreeze) 129: # if [ "$device" = "/dev/sdX" -o "$device" = "/dev/sdY" ] 130: # then 131: # proc="fsfreeze" 132: # result="`/sbin/fsfreeze -f $mount_point 2>&1 `" 133: # if [ $? != 0 ] 134: # then 135: # echo "$result" > $err_log_path/$dev.fsfreeze 136: # exit 14 137: # fi 138: # echo "fsfreeze" > $post_file 139: # fi 140: 141: # When device can be unmounted 142: # 143: # if [ "$proc" = "" ];then 144: if [ `/bin/cat /proc/mounts |/bin/cut -d' ' -f 2|/bin/grep "^$mount_point\$"|/usr/bin/wc -w` != 1 ]; then 145: # stack mount (multi device on $mount_point) 146: /bin/mount > $err_log_path/$dev.umount 2>&1 147: exit 13 148: fi 149: if [ `/bin/cat /proc/mounts |/bin/cut -d' ' -f 1|/bin/grep "^$device\$"|/usr/bin/wc -w` != 1 ]; then 150: cdevice="/dev/`/usr/bin/readlink $device | /bin/sed "s/..\/..\///"`" 151: if [ `/bin/cat /proc/mounts |/bin/cut -d' ' -f 1|/bin/grep "^$cdevice\$"|/usr/bin/wc -w` != 1 ]; then 152: # bind mount (device has multi mount point) 153: /bin/mount > $err_log_path/$dev.umount 2>&1 154: exit 13 155: fi 156: fi 157: 158: /bin/awk "\$2==\"$mount_point\" {print \$3}" /proc/mounts > $fstype_file 159: /bin/umount $mount_point 2>/dev/null 160: if [ $? != 0 ] 161: then 162: retry_count=3 163: sleep_time=1 164: result_flag=1 165: 166: while [ $retry_count -gt 0 ] 167: do 168: /bin/umount $mount_point > $err_log_path/$dev.umount 2>&1 169: if [ $? != 0 ] 170: then 171: retry_count=`expr $retry_count - 1` 172: /bin/sleep $sleep_time 173: else 174: /bin/rm -f $err_log_path/$dev.umount 175: result_flag=0 176: break 177: fi 178: done 179: 180: if [ $result_flag != 0 ] 181: then 182: /sbin/fuser -vum $mount_point> $err_log_path/$dev.fuser 2>&1 183: /bin/ps -ef > $err_log_path/$dev.ps 2>&1 184: 185: exit 10 186: fi 187: fi 188: echo "mount" > $post_file 189: 190: # fi 191: 192: # When device was not mounted 193: # 194: else 195: echo "none" > $post_file 196: fi 197: 198: exit 0
SUSE Linux Enterprise Server 12の場合
1: #!/bin/sh 2: 3: # AdvancedCopy Manager 4: # All Rights Reserved, Copyright FUJITSU LIMITED, 2002-2011 5: 6: # 7: # Preprocessing of backup processing 8: # 9: # Argument: $1 Device name of transaction disk 10: # $2 Mount point of transaction disk 11: # $3 Device name of backup disk 12: # 13: # Error number 14: # 2: Argument error 15: # 10: umount error 16: # 13: Illegal mount type (bind/stack mount) 17: 18: 19: # Argument check 20: case $# in 21: 1) 22: ;; 23: 2) 24: ;; 25: 3) 26: ;; 27: *) 28: exit 2 29: ;; 30: esac 31: 32: device="`echo $1`" 33: mount_point="`echo $2`" 34: bk_device="`echo $3`" 35: 36: # Determination postprocessing file name 37: 38: if [ "$SWSTGNODE" != "" ] 39: then 40: swstg_node="/`echo $SWSTGNODE`" 41: else 42: swstg_node="" 43: fi 44: 45: err_log_path="/var/opt/FJSVswsts"$swstg_node"/log" 46: 47: if [ "`echo $device | /bin/grep "/dev/sd"`" != "" ] 48: then 49: # /dev/sd? -> sd? 50: dev="`echo $device | /bin/sed "s/\/dev\///"`" 51: elif [ "`echo $device | /bin/grep "/dev/FJSV"`" != "" ] 52: then 53: # /dev/FJSVmphd/dsk/mplb?s? -> mplb?s? 54: # /dev/FJSVmphd/dsk/mphd?s? -> mphd?s? 55: dev="`echo $device | /usr/bin/cut -d/ -f5`" 56: elif [ "`echo $device | /bin/grep "/dev/sfdsk/"`" != "" ] 57: then 58: if [ "`echo $device | /bin/grep ":"`" != "" ] 59: then 60: devnam="`echo $device | /usr/bin/cut -d: -f2-`" 61: # /dev/sfdsk/class/dsk/volume:sd? -> class_volume_sd? 62: dev="`echo $device | /bin/sed "s/\/dev\/sfdsk\///"`" 63: dev="`echo $dev | /bin/sed "s/\/dsk\//_/"`" 64: dev="`echo $dev | /bin/sed "s/:/_/"`" 65: device="`echo $device | /usr/bin/cut -d: -f1`" 66: if [ "`echo $devnam | /bin/grep "/dev/disk/by-id/"`" != "" ] 67: then 68: # /dev/sfdsk/class/dsk/volume:/dev/disk/by-id/<device> -> class_volume__by_id_<device> 69: dev="`echo $dev | /bin/sed "s/\/dev\/disk\/by-id\//_by-id_/"`" 70: elif [ "`echo $devnam | /bin/grep "/dev/disk/by-path/"`" != "" ] 71: then 72: # /dev/sfdsk/class/dsk/volume:/dev/disk/by-path/<device> -> class_volume__by_path_<device> 73: dev="`echo $dev | /bin/sed "s/\/dev\/disk\/by-path\//_by-path_/"`" 74: fi 75: else 76: # /dev/sfdsk/class/dsk/volume -> _gds_class_volume 77: dev="_gds_`echo $device | /bin/sed "s/\/dev\/sfdsk\///"`" 78: dev="`echo $dev | /bin/sed "s/\/dsk\//_/"`" 79: fi 80: elif [ "`echo $device | /bin/grep "/dev/vx/dmp/"`" != "" ] 81: then 82: # /dev/vx/dmp/device -> _vx_pv_device 83: dev="_vx_pv_`echo $device | /bin/sed "s/\/dev\/vx\/dmp\///"`" 84: elif [ "`echo $device | /bin/grep "/dev/mapper/"`" != "" ] 85: then 86: # "/dev/mapper/<device>" -> "_mapper_<device>" 87: dev="_mapper_`echo $device | /bin/sed "s/\/dev\/mapper\///"`" 88: elif [ "`echo $device | /bin/grep "/dev/disk/by-id/"`" != "" ] 89: then 90: # "/dev/disk/by-id/<device>" -> "_by-id_<device>" 91: dev="_by-id_`echo $device | /bin/sed "s/\/dev\/disk\/by-id\///"`" 92: elif [ "`echo $device | /bin/grep "/dev/disk/by-path/"`" != "" ] 93: then 94: # "/dev/disk/by-path/<device>" -> "_by-path_<device>" 95: dev="_by-path_`echo $device | /bin/sed "s/\/dev\/disk\/by-path\///"`" 96: else 97: exit 0 98: fi 99: post_file="/etc/opt/FJSVswsts"$swstg_node"/data/DEFAULT/"$dev".pre" 100: fstype_file="/etc/opt/FJSVswsts"$swstg_node"/data/DEFAULT/"$dev".fstype" 101: bd_file="/etc/opt/FJSVswsts"$swstg_node"/data/DEFAULT/"$dev".bd" 102: 103: if [ "$mount_point" != "" ] 104: then 105: 106: # When device cannot be unmounted 107: # 108: # if [ "$device" = "/dev/sdX" -o "$device" = "/dev/sdY" ] 109: # then 110: # if [ "$bk_device" != "" ] 111: # then 112: # echo $bk_device > $bd_file 113: # fi 114: # /bin/awk "\$2==\"$mount_point\" {print \$3}" /proc/mounts > $fstype_file 115: # /bin/sync 116: # /bin/sync 117: # /bin/sync 118: # echo "fsck" > $post_file 119: 120: # When device can be unmounted 121: # 122: # else 123: if [ `/bin/cat /proc/mounts | /usr/bin/cut -d' ' -f 2|/bin/grep "^$mount_point\$"|/usr/bin/wc -w` != 1 ]; then 124: # stack mount (multi device on $mount_point) 125: /bin/mount > $err_log_path/$dev.umount 2>&1 126: exit 13 127: fi 128: if [ `/bin/cat /proc/mounts | /usr/bin/cut -d' ' -f 1|/bin/grep "^$device\$"|/usr/bin/wc -w` != 1 ]; then 129: cdevice="/dev/`/usr/bin/readlink $device | /bin/sed "s/..\/..\///"`" 130: if [ `/bin/cat /proc/mounts | /usr/bin/cut -d' ' -f 1|/bin/grep "^$cdevice\$"|/usr/bin/wc -w` != 1 ]; then 131: /bin/mount > $err_log_path/$dev.umount 2>&1 132: exit 13 133: fi 134: fi 135: 136: /bin/awk "\$2==\"$mount_point\" {print \$3}" /proc/mounts > $fstype_file 137: /bin/umount $mount_point 2>/dev/null 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: /bin/umount $mount_point > $err_log_path/$dev.umount 2>&1 147: if [ $? != 0 ] 148: then 149: retry_count=`expr $retry_count - 1` 150: /bin/sleep $sleep_time 151: else 152: /bin/rm -f $err_log_path/$dev.umount 153: result_flag=0 154: break 155: fi 156: done 157: 158: if [ $result_flag != 0 ] 159: then 160: /bin/fuser -vum $mount_point> $err_log_path/$dev.fuser 2>&1 161: /bin/ps -ef > $err_log_path/$dev.ps 2>&1 162: 163: exit 10 164: fi 165: fi 166: echo "mount" > $post_file 167: 168: # fi 169: 170: # When device was not mounted 171: # 172: else 173: echo "none" > $post_file 174: fi 175: 176: exit 0