バックアップ実行時の前処理のシェルスクリプト名は、以下のとおりです。
非クラスタ運用の場合
/etc/opt/FJSVswsts/sh/OpcBackup.pre |
クラスタ運用の場合
/etc/opt/FJSVswsts/<論理ノード名>/sh/OpcBackup.pre |
バックアップ時の前処理シェルスクリプト
1: #!/bin/sh 2: 3: # AdvancedCopy Manager 4: # All Rights Reserved, Copyright FUJITSU LIMITED, 2002-2009 5: 6: # 7: # Pre-processing 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 | /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 | /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 | /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/disk/by-id/"`" != "" ] 81: then 82: # "/dev/disk/by-id/<device>" -> "_by-id_<device>" 83: dev="_by-id_`echo $device | /bin/sed "s/\/dev\/disk\/by-id\///"`" 84: elif [ "`echo $device | /bin/grep "/dev/disk/by-path/"`" != "" ] 85: then 86: # "/dev/disk/by-path/<device>" -> "_by-path_<device>" 87: dev="_by-path_`echo $device | /bin/sed "s/\/dev\/disk\/by-path\///"`" 88: else 89: exit 0 90: fi 91: post_file="/etc/opt/FJSVswsts"$swstg_node"/data/DEFAULT/"$dev".pre" 92: fstype_file="/etc/opt/FJSVswsts"$swstg_node"/data/DEFAULT/"$dev".fstype" 93: bd_file="/etc/opt/FJSVswsts"$swstg_node"/data/DEFAULT/"$dev".bd" 94: 95: if [ "$mount_point" != "" ] 96: then 97: 98: # When device cannot be unmounted 99: # 100: # if [ "$device" = "/dev/sdX" -o "$device" = "/dev/sdY" ] 101: # then 102: # if [ "$bk_device" != "" ] 103: # then 104: # echo $bk_device > $bd_file 105: # fi 106: # /bin/awk "\$2==\"$mount_point\" {print \$3}" /proc/mounts > $fstype_file 107: # /bin/sync 108: # /bin/sync 109: # /bin/sync 110: # echo "fsck" > $post_file 111: 112: # When device can be unmounted 113: # 114: # else 115: if [ `/bin/cat /proc/mounts |/bin/cut -d' ' -f 2|/bin/grep "^$mount_point\$"|/usr/bin/wc -w` != 1 ]; then 116: # stack mount (multi device on $mount_point) 117: /bin/mount > $err_log_path/$dev.umount 2>&1 118: exit 13 119: fi 120: if [ `/bin/cat /proc/mounts |/bin/cut -d' ' -f 1|/bin/grep "^$device\$"|/usr/bin/wc -w` != 1 ]; then 121: # bind mount (device has multi mount point) 122: /bin/mount > $err_log_path/$dev.umount 2>&1 123: exit 13 124: fi 125: 126: /bin/awk "\$2==\"$mount_point\" {print \$3}" /proc/mounts > $fstype_file 127: /bin/umount $mount_point 2>/dev/null 128: if [ $? != 0 ] 129: then 130: retry_count=3 131: sleep_time=1 132: result_flag=1 133: 134: while [ $retry_count -gt 0 ] 135: do 136: /bin/umount $mount_point > $err_log_path/$dev.umount 2>&1 137: if [ $? != 0 ] 138: then 139: retry_count=`expr $retry_count - 1` 140: /bin/sleep $sleep_time 141: else 142: /bin/rm -f $err_log_path/$dev.umount 143: result_flag=0 144: break 145: fi 146: done 147: 148: if [ $result_flag != 0 ] 149: then 150: /sbin/fuser -vum $mount_point> $err_log_path/$dev.fuser 2>&1 151: /bin/ps -ef > $err_log_path/$dev.ps 2>&1 152: 153: exit 10 154: fi 155: fi 156: echo "mount" > $post_file 157: 158: # fi 159: 160: # When device was not mounted 161: # 162: else 163: echo "none" > $post_file 164: fi 165: 166: exit 0 |