ETERNUS SF AdvancedCopy Manager 運用手引書 13.0 -Linux- |
目次
索引
![]() ![]() |
本章では、AdvancedCopy Managerのバックアップおよびリストアの前後処理を行うシェルスクリプトについて説明します。
バックアップ・リストアの前後処理のシェルスクリプトは、バックアップ実行コマンドまたはリストア実行コマンドを実施した際に、バックアップ・リストア処理の前後で起動されます。
これらのシェルスクリプトには、AdvancedCopy Managerが、業務ボリュームのバックアップおよびリストアを行う際に必要な処理を記述します。
この章では、前後処理の設定について説明します。
AdvancedCopy Managerでのバックアップは、基本的に業務ボリュームがアンマウントされた状態で処理を行う必要があります。
そのため、通常、前処理では、業務ボリューム名からそのボリュームのマウント状態を獲得し、次の処理を行います。
業務ボリュームの状態 |
前処理 |
---|---|
マウントされている |
業務ボリュームをアンマウントします。(注) |
アンマウントされている |
何も処理しません。 |
(注)ただし、都合によりどうしても業務ボリュームをアンマウントできない場合は、『業務ボリュームをアンマウントしたくない場合』を参照し、前処理のシェルスクリプトをカスタマイズしてください。
後処理は、前処理で行った処理によって何をするのかを判断します。
前処理 |
後処理 |
---|---|
業務ボリュームをアンマウントした。 |
業務ボリュームをマウントし直します。 |
何も処理しなかった。 |
何も処理しません。 |
データベースとして使用している業務ボリュームのように、最初から業務ボリュームがマウントされていない場合は、前後処理ともに何も処理しません。
この他にも、特殊な前後処理が必要な場合は、シェルスクリプトに処理を追加する必要があります。
スクリプトをカスタマイズする場合、エラーコードは以下の規約に従ってください。
エラーコード |
用途 |
---|---|
0-99 |
使用不可(AdvancedCopy Managerが予約) |
100-255 |
使用可能 |
後処理に失敗した場合は、資源情報の整合性が不完全になっている可能性がありますので、資源整合コマンドを実施してください。
バックアップ実行時の前処理のシェルスクリプト名は、以下の通りです。
非クラスタ運用の場合
/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-2006 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 | /bin/cut -d/ -f5`" 56: elif [ "`echo $device | /bin/grep "/dev/sfdsk/"`" != "" ] 57: then 58: if [ "`echo $device | /bin/grep ":"`" != "" ] 59: then 60: # /dev/sfdsk/class/dsk/volume:sd? -> class_volume_sd? 61: dev="`echo $device | /bin/sed "s/\/dev\/sfdsk\///"`" 62: dev="`echo $dev | /bin/sed "s/\/dsk\//_/"`" 63: dev="`echo $dev | /bin/sed "s/:/_/"`" 64: device="`echo $device | /bin/cut -d: -f1`" 65: else 66: # /dev/sfdsk/class/dsk/volume -> _gds_class_volume 67: dev="_gds_`echo $device | /bin/sed "s/\/dev\/sfdsk\///"`" 68: dev="`echo $dev | /bin/sed "s/\/dsk\//_/"`" 69: fi 70: else 71: exit 0 72: fi 73: post_file="/etc/opt/FJSVswsts"$swstg_node"/data/DEFAULT/"$dev".pre" 74: fstype_file="/etc/opt/FJSVswsts"$swstg_node"/data/DEFAULT/"$dev".fstype" 75: bd_file="/etc/opt/FJSVswsts"$swstg_node"/data/DEFAULT/"$dev".bd" 76: 77: if [ "$mount_point" != "" ] 78: then 79: 80: # When device cannot be unmounted 81: # 82: # if [ "$device" = "/dev/sd*" ] 83: # then 84: # if [ "$bk_device" != "" ] 85: # then 86: # echo $bk_device > $bd_file 87: # fi 88: # /bin/awk "\$2==\"$mount_point\" {print \$3}" /proc/mounts > $fstype_file 89: # /bin/sync 90: # /bin/sync 91: # /bin/sync 92: # echo "fsck" > $post_file 93: 94: # When device can be unmounted 95: # 96: # else 97: if [ `/bin/cat /proc/mounts |/bin/cut -d' ' -f 2|/bin/grep "^$mount_point\$"|/usr/bin/wc -w` != 1 ]; then 98: # stack mount (multi device on $mount_point) 99: /bin/mount > $err_log_path/$dev.umount 2>&1 100: exit 13 101: fi 102: if [ `/bin/cat /proc/mounts |/bin/cut -d' ' -f 1|/bin/grep "^$device\$"|/usr/bin/wc -w` != 1 ]; then 103: # bind mount (device has multi mount point) 104: /bin/mount > $err_log_path/$dev.umount 2>&1 105: exit 13 106: fi 107: 108: /bin/awk "\$2==\"$mount_point\" {print \$3}" /proc/mounts > $fstype_file 109: /bin/umount $mount_point 2>/dev/null 110: if [ $? != 0 ] 111: then 112: retry_count=3 113: sleep_time=1 114: result_flag=1 115: 116: while [ $retry_count -gt 0 ] 117: do 118: /bin/umount $mount_point > $err_log_path/$dev.umount 2>&1 119: if [ $? != 0 ] 120: then 121: retry_count=`expr $retry_count - 1` 122: /bin/sleep $sleep_time 123: else 124: /bin/rm -f $err_log_path/$dev.umount 125: result_flag=0 126: break 127: fi 128: done 129: 130: if [ $result_flag != 0 ] 131: then 132: /sbin/fuser -vu $mount_point> $err_log_path/$dev.fuser 2>&1 133: /bin/ps -ef > $err_log_path/$dev.ps 2>&1 134: 135: exit 10 136: fi 137: fi 138: echo "mount" > $post_file 139: 140: # fi 141: 142: # When device was not mounted 143: # 144: else 145: echo "none" > $post_file 146: fi 147: 148: exit 0 |
マウントされているがアンマウントしたくない業務ボリュームに対しては、82〜92、96、140行目のコメント(“#”)をエディタ等で消去し、82行目のif文で対象となるデバイスを指示してください。なお、91行目のsyncコマンドを実施してからバックアップ後処理を実施するまでの間は、業務ボリュームのファイルシステム更新操作を行わないようにしてください。もし、この間にファイルシステム更新操作が行われると、ファイルシステムが不完全な状態でバックアップが採取されるか、またはバックアップ後処理で実施するfsckコマンドがエラーとなる可能性があります。
この操作は、ファイルシステムが以下の場合のみ可能です。
ext2
ext3
カスタマイズしたスクリプトによる前処理の動作は、以下のようになります。
業務ボリュームの状態 |
前処理 |
---|---|
マウントされている |
業務ボリュームへの更新を抑止します |
カスタマイズしたスクリプトによる後処理の動作は、以下のようになります。
前処理 |
後処理 |
---|---|
業務ボリュームへの更新を抑止した |
業務ボリュームへの更新抑止を解除します バックアップボリュームの整合性を確認します |
バックアップ実行時の後処理のシェルスクリプト名は、以下の通りです。
非クラスタ運用の場合
/etc/opt/FJSVswsts/sh/OpcBackup.post
クラスタ運用の場合
/etc/opt/FJSVswsts/<論理ノード名>/sh/OpcBackup.post
1: #!/bin/sh 2: 3: # AdvancedCopy Manager 4: # All Rights Reserved, Copyright FUJITSU LIMITED, 2002-2006 5: 6: # 7: # Postprocessing of backup processing 8: # 9: # Argument: $1 Device name of transaction disk 10: # $2 Mount point of transaction disk 11: # 12: # Error number 13: # 2: Argument error 14: # 11: mount error 15: # 12: fsck error 16: 17: # Argument check 18: case $# in 19: 1) 20: ;; 21: 2) 22: ;; 23: *) 24: exit 2 25: ;; 26: esac 27: 28: device="`echo $1`" 29: mount_point="`echo $2`" 30: 31: # Determination of postprocessing file name 32: 33: if [ "$SWSTGNODE" != "" ] 34: then 35: swstg_node="/`echo $SWSTGNODE`" 36: else 37: swstg_node="" 38: fi 39: 40: err_log_path="/var/opt/FJSVswsts"$swstg_node"/log" 41: 42: if [ "`echo $device | /bin/grep "/dev/sd"`" != "" ] 43: then 44: # /dev/sd? -> sd? 45: dev="`echo $device | /bin/sed "s/\/dev\///"`" 46: elif [ "`echo $device | /bin/grep "/dev/FJSV"`" != "" ] 47: then 48: # /dev/FJSVmphd/dsk/mplb?s? -> mplb?s? 49: # /dev/FJSVmphd/dsk/mphd?s? -> mphd?s? 50: dev="`echo $device | /bin/cut -d/ -f5`" 51: elif [ "`echo $device | /bin/grep "/dev/sfdsk/"`" != "" ] 52: then 53: if [ "`echo $device | /bin/grep ":"`" != "" ] 54: then 55: # /dev/sfdsk/class/dsk/volume:sd? -> class_volume_sd? 56: dev="`echo $device | /bin/sed "s/\/dev\/sfdsk\///"`" 57: dev="`echo $dev | /bin/sed "s/\/dsk\//_/"`" 58: dev="`echo $dev | /bin/sed "s/:/_/"`" 59: device="`echo $device | /bin/cut -d: -f1`" 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: else 66: exit 0 67: fi 68: post_file="/etc/opt/FJSVswsts"$swstg_node"/data/DEFAULT/"$dev".pre" 69: fstype_file="/etc/opt/FJSVswsts"$swstg_node"/data/DEFAULT/"$dev".fstype" 70: bd_file="/etc/opt/FJSVswsts"$swstg_node"/data/DEFAULT/"$dev".bd" 71: 72: # Confirmation of postprocessing 73: if [ ! -r $post_file ] 74: then 75: exit 0 76: fi 77: post="`/bin/cat $post_file`" 78: 79: # Confirmation of FStype 80: if [ ! -r $fstype_file ] 81: then 82: fs="" 83: else 84: fs="`/bin/cat $fstype_file`" 85: fi 86: 87: # No processing 88: if [ "$post" = "none" ] 89: then 90: /bin/rm -rf $post_file 2> /dev/null 91: /bin/rm -rf $fstype_file 2> /dev/null 92: exit 0 93: fi 94: 95: # mount processing 96: if [ "$post" = "mount" ] 97: then 98: Result="`/bin/df -l | /bin/grep "$device " | /bin/awk 'END {print NR}'`" 99: if [ "$Result" != "1" ] 100: then 101: if [ ! -r $fstype_file ] 102: then 103: /bin/mount $device $mount_point 2> /dev/null 104: else 105: Result1="`echo $fs | /bin/awk 'END {print NR}'`" 106: if [ "$Result1" != "1" ] 107: then 108: /bin/mount $device $mount_point 2> /dev/null 109: else 110: /bin/mount -t $fs $device $mount_point 2> /dev/null 111: fi 112: fi 113: if [ $? != 0 ] 114: then 115: retry_count=3 116: sleep_time=1 117: result_flag=1 118: 119: while [ $retry_count -gt 0 ] 120: do 121: if [ ! -r $fstype_file ] 122: then 123: /bin/mount $device $mount_point > $err_log_path/$dev.mount 2>&1 124: else 125: Result1="`echo $fs | /bin/awk 'END {print NR}'`" 126: if [ "$Result1" != "1" ] 127: then 128: /bin/mount $device $mount_point > $err_log_path/$dev.mount 2>&1 129: else 130: /bin/mount -t $fs $device $mount_point > $err_log_path/$dev.mount 2>&1 131: fi 132: fi 133: if [ $? != 0 ] 134: then 135: retry_count=`expr $retry_count - 1` 136: /bin/sleep $sleep_time 137: else 138: /bin/rm -f $err_log_path/$dev.mount 139: result_flag=0 140: break 141: fi 142: done 143: 144: if [ $result_flag != 0 ] 145: then 146: exit 11 147: fi 148: fi 149: fi 150: /bin/rm -rf $post_file 2> /dev/null 151: /bin/rm -rf $fstype_file 2> /dev/null 152: exit 0 153: fi 154: 155: # fsck processing 156: if [ "$post" = "fsck" ] 157: then 158: if [ -r $bd_file ] 159: then 160: bk_device="`/bin/cat $bd_file`" 161: fsck_dev="`echo $bk_device `" 162: if [ ! -r $fstype_file ] 163: then 164: /sbin/fsck -c $fsck_dev > /dev/null 2>&1 165: else 166: if [ "$fs" = "" ] 167: then 168: /sbin/fsck -c $fsck_dev > /dev/null 2>&1 169: else 170: if [ "$fs" = "sfxfs" ] 171: then 172: /sbin/sfxadm $fsck_dev > /dev/null 2>&1 173: /sbin/fsck -p -t $fs $fsck_dev > /dev/null 2>&1 174: else 175: /sbin/fsck -p -t $fs $fsck_dev > /dev/null 2>&1 176: fi 177: fi 178: fi 179: if [ $? != 0 ] 180: then 181: if [ "$fs" = "" ] 182: then 183: result="`/sbin/fsck -p $fsck_dev `" 184: else 185: result="`/sbin/fsck -p -t $fs $fsck_dev `" 186: fi 187: fsck_rc=$? 188: if [ $fsck_rc != 0 ] && [ $fsck_rc != 1 ] 189: then 190: echo "$result" > $err_log_path/$dev.fsck 191: exit 12 192: fi 193: fi 194: fi 195: /bin/rm -rf $post_file 2> /dev/null 196: /bin/rm -rf $fstype_file 2> /dev/null 197: /bin/rm -rf $bd_file 2> /dev/null 198: exit 0 199: fi 200: 201: exit 0 |
AdvancedCopy Managerでのリストアは、業務ボリュームがアンマウントされた状態で処理を行う必要があります。
そのため、通常、前処理では、業務ボリューム名からそのボリュームのマウント状態を獲得し、次の処理を行います。
業務ボリュームの状態 |
前処理 |
---|---|
マウントされている |
業務ボリュームをアンマウントします。 |
アンマウントされている |
何も処理しません。 |
後処理は、前処理で行った処理によって何をするのかを判断します。
前処理 |
後処理 |
---|---|
業務ボリュームをアンマウントした。 |
業務ボリュームをマウントし直します。 |
何も処理しなかった。 |
何も処理しません。 |
この他にも、特殊な前後処理が必要な場合は、シェルスクリプトに処理を追加する必要があります。
スクリプトをカスタマイズする場合、エラーコードは以下の規約に従ってください。
エラーコード |
用途 |
---|---|
0-99 |
使用不可(AdvancedCopy Managerが予約) |
100-255 |
使用可能 |
後処理に失敗した場合は、資源情報の整合性が不完全になっている可能性がありますので、資源整合コマンドを実施してください。
リストア実行時の前処理のシェルスクリプト名は、以下の通りです。
非クラスタ運用の場合
/etc/opt/FJSVswsts/sh/OpcRestore.pre
クラスタ運用の場合
/etc/opt/FJSVswsts/<論理ノード名>/sh/OpcRestore.pre
1: #!/bin/sh 2: 3: # AdvancedCopy Manager 4: # All Rights Reserved, Copyright FUJITSU LIMITED, 2002-2006 5: 6: # 7: # Preprocessing of restoration processing 8: # 9: # Argument: $1 Device name of transaction disk 10: # $2 Mount point of transaction disk 11: # 12: # Error number 13: # 2: Argument error 14: # 10: umount error 15: # 13: Illegal mount type (bind/stack mount) 16: 17: 18: # Argument check 19: case $# in 20: 1) 21: ;; 22: 2) 23: ;; 24: *) 25: exit 2 26: ;; 27: esac 28: 29: device="`echo $1`" 30: mount_point="`echo $2`" 31: 32: # Determination of postprocessing file name 33: 34: if [ "$SWSTGNODE" != "" ] 35: then 36: swstg_node="/`echo $SWSTGNODE`" 37: else 38: swstg_node="" 39: fi 40: 41: err_log_path="/var/opt/FJSVswsts"$swstg_node"/log" 42: 43: if [ "`echo $device | /bin/grep "/dev/sd"`" != "" ] 44: then 45: # /dev/sd? -> sd? 46: dev="`echo $device | /bin/sed "s/\/dev\///"`" 47: elif [ "`echo $device | /bin/grep "/dev/FJSV"`" != "" ] 48: then 49: # /dev/FJSVmphd/dsk/mplb?s? -> mplb?s? 50: # /dev/FJSVmphd/dsk/mphd?s? -> mphd?s? 51: dev="`echo $device | /bin/cut -d/ -f5`" 52: elif [ "`echo $device | /bin/grep "/dev/sfdsk/"`" != "" ] 53: then 54: if [ "`echo $device | /bin/grep ":"`" != "" ] 55: then 56: # /dev/sfdsk/class/dsk/volume:sd? -> class_volume_sd? 57: dev="`echo $device | /bin/sed "s/\/dev\/sfdsk\///"`" 58: dev="`echo $dev | /bin/sed "s/\/dsk\//_/"`" 59: dev="`echo $dev | /bin/sed "s/:/_/"`" 60: device="`echo $device | /bin/cut -d: -f1`" 61: else 62: # /dev/sfdsk/class/dsk/volume -> _gds_class_volume 63: dev="_gds_`echo $device | /bin/sed "s/\/dev\/sfdsk\///"`" 64: dev="`echo $dev | /bin/sed "s/\/dsk\//_/"`" 65: fi 66: else 67: exit 0 68: fi 69: post_file="/etc/opt/FJSVswsts"$swstg_node"/data/DEFAULT/"$dev".pre" 70: fstype_file="/etc/opt/FJSVswsts"$swstg_node"/data/DEFAULT/"$dev".fstype" 71: 72: if [ "$mount_point" != "" ] 73: then 74: if [ `/bin/cat /proc/mounts |/bin/cut -d' ' -f 2|/bin/grep "^$mount_point\$"|/usr/bin/wc -w` != 1 ]; then 75: # stack mount (multi device on $mount_point) 76: /bin/mount > $err_log_path/$dev.umount 2>&1 77: exit 13 78: fi 79: if [ `/bin/cat /proc/mounts |/bin/cut -d' ' -f 1|/bin/grep "^$device\$"|/usr/bin/wc -w` != 1 ]; then 80: # bind mount (device has multi mount point) 81: /bin/mount > $err_log_path/$dev.umount 2>&1 82: exit 13 83: fi 84: 85: 86: # When device can be unmounted 87: # 88: # df -ln $mount_point | cut -f2 -d: | cut -f2 -d' ' > $fstype_file 89: /bin/awk "\$2==\"$mount_point\" {print \$3}" /proc/mounts > $fstype_file 90: /bin/umount $mount_point 2> /dev/null 91: if [ $? != 0 ] 92: then 93: retry_count=3 94: sleep_time=1 95: result_flag=1 96: 97: while [ $retry_count -gt 0 ] 98: do 99: /bin/umount $mount_point > $err_log_path/$dev.umount 2>&1 100: if [ $? != 0 ] 101: then 102: retry_count=`expr $retry_count - 1` 103: /bin/sleep $sleep_time 104: else 105: /bin/rm -f $err_log_path/$dev.umount 106: result_flag=0 107: break 108: fi 109: done 110: 111: if [ $result_flag != 0 ] 112: then 113: /sbin/fuser -vu $mount_point> $err_log_path/$dev.fuser 2>&1 114: /bin/ps -ef > $err_log_path/$dev.ps 2>&1 115: 116: exit 10 117: fi 118: fi 119: echo "mount" > $post_file 120: 121: # When device was not mounted 122: # 123: else 124: echo "none" > $post_file 125: fi 126: 127: exit 0 |
マウントされているがアンマウントできない業務ボリュームに対しては、リストアはできません。リストア先のデバイスを指示してください。
リスト実行時の後処理のシェルスクリプト名は、以下の通りです。
非クラスタ運用の場合
/etc/opt/FJSVswsts/sh/OpcRestore.post
クラスタ運用の場合
/etc/opt/FJSVswsts/<論理ノード名>/sh/OpcRestore.post
1: #!/bin/sh 2: 3: # AdvancedCopy Manager 4: # All Rights Reserved, Copyright FUJITSU LIMITED, 2002-2006 5: 6: # 7: # Preprocessing of restoration processing 8: # 9: # Argument: $1 Device name of transaction disk 10: # $2 Mount point of transaction disk 11: # 12: # Error number 13: # 2: Argument error 14: # 10: umount error 15: # 13: Illegal mount type (bind/stack mount) 16: 17: 18: # Argument check 19: case $# in 20: 1) 21: ;; 22: 2) 23: ;; 24: *) 25: exit 2 26: ;; 27: esac 28: 29: device="`echo $1`" 30: mount_point="`echo $2`" 31: 32: # Determination of postprocessing file name 33: 34: if [ "$SWSTGNODE" != "" ] 35: then 36: swstg_node="/`echo $SWSTGNODE`" 37: else 38: swstg_node="" 39: fi 40: 41: err_log_path="/var/opt/FJSVswsts"$swstg_node"/log" 42: 43: if [ "`echo $device | /bin/grep "/dev/sd"`" != "" ] 44: then 45: # /dev/sd? -> sd? 46: dev="`echo $device | /bin/sed "s/\/dev\///"`" 47: elif [ "`echo $device | /bin/grep "/dev/FJSV"`" != "" ] 48: then 49: # /dev/FJSVmphd/dsk/mplb?s? -> mplb?s? 50: # /dev/FJSVmphd/dsk/mphd?s? -> mphd?s? 51: dev="`echo $device | /bin/cut -d/ -f5`" 52: elif [ "`echo $device | /bin/grep "/dev/sfdsk/"`" != "" ] 53: then 54: if [ "`echo $device | /bin/grep ":"`" != "" ] 55: then 56: # /dev/sfdsk/class/dsk/volume:sd? -> class_volume_sd? 57: dev="`echo $device | /bin/sed "s/\/dev\/sfdsk\///"`" 58: dev="`echo $dev | /bin/sed "s/\/dsk\//_/"`" 59: dev="`echo $dev | /bin/sed "s/:/_/"`" 60: device="`echo $device | /bin/cut -d: -f1`" 61: else 62: # /dev/sfdsk/class/dsk/volume -> _gds_class_volume 63: dev="_gds_`echo $device | /bin/sed "s/\/dev\/sfdsk\///"`" 64: dev="`echo $dev | /bin/sed "s/\/dsk\//_/"`" 65: fi 66: else 67: exit 0 68: fi 69: post_file="/etc/opt/FJSVswsts"$swstg_node"/data/DEFAULT/"$dev".pre" 70: fstype_file="/etc/opt/FJSVswsts"$swstg_node"/data/DEFAULT/"$dev".fstype" 71: 72: if [ "$mount_point" != "" ] 73: then 74: if [ `/bin/cat /proc/mounts |/bin/cut -d' ' -f 2|/bin/grep "^$mount_point\$"|/usr/bin/wc -w` != 1 ]; then 75: # stack mount (multi device on $mount_point) 76: /bin/mount > $err_log_path/$dev.umount 2>&1 77: exit 13 78: fi 79: if [ `/bin/cat /proc/mounts |/bin/cut -d' ' -f 1|/bin/grep "^$device\$"|/usr/bin/wc -w` != 1 ]; then 80: # bind mount (device has multi mount point) 81: /bin/mount > $err_log_path/$dev.umount 2>&1 82: exit 13 83: fi 84: 85: 86: # When device can be unmounted 87: # 88: # df -ln $mount_point | cut -f2 -d: | cut -f2 -d' ' > $fstype_file 89: /bin/awk "\$2==\"$mount_point\" {print \$3}" /proc/mounts > $fstype_file 90: /bin/umount $mount_point 2> /dev/null 91: if [ $? != 0 ] 92: then 93: retry_count=3 94: sleep_time=1 95: result_flag=1 96: 97: while [ $retry_count -gt 0 ] 98: do 99: /bin/umount $mount_point > $err_log_path/$dev.umount 2>&1 100: if [ $? != 0 ] 101: then 102: retry_count=`expr $retry_count - 1` 103: /bin/sleep $sleep_time 104: else 105: /bin/rm -f $err_log_path/$dev.umount 106: result_flag=0 107: break 108: fi 109: done 110: 111: if [ $result_flag != 0 ] 112: then 113: /sbin/fuser -vu $mount_point> $err_log_path/$dev.fuser 2>&1 114: /bin/ps -ef > $err_log_path/$dev.ps 2>&1 115: 116: exit 10 117: fi 118: fi 119: echo "mount" > $post_file 120: 121: # When device was not mounted 122: # 123: else 124: echo "none" > $post_file 125: fi 126: 127: exit 0 |
目次
索引
![]() ![]() |