テープコピー実行時の前処理のシェルスクリプト名は、以下のとおりです。
非クラスタ運用の場合
/etc/opt/FJSVswsts/sh/TapeCopy.pre |
クラスタ運用の場合
/etc/opt/FJSVswsts/<論理ノード名>/sh/TapeCopy.pre |
シェルスクリプトの内容は、以下のとおりです。
1: #!/bin/sh 2: 3: # AdvancedCopy Manager 4: # All Rights Reserved, Copyright FUJITSU LIMITED, 2005-2011 5: 6: # 7: # Preprocessing of tape copy processing 8: # 9: # Argument: $1 Device name of backup disk 10: # $2 Reserve 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: 31: # Determination 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: # /dev/sfdsk/class/dsk/volume -> _gds_class_volume 54: dev="_gds_`echo $device | /bin/sed "s/\/dev\/sfdsk\///"`" 55: dev="`echo $dev | /bin/sed "s/\/dsk\//_/"`" 56: elif [ "`echo $device | /bin/grep "/dev/vx/dmp/"`" != "" ] 57: then 58: # "/dev/vx/dmp/<device>" -> "_vx_pv_<device>" 59: dev="_vx_pv_`echo $device | /bin/sed "s/\/dev\/vx\/dmp\///"`" 60: elif [ "`echo $device | /bin/grep "/dev/mapper/"`" != "" ] 61: then 62: # "/dev/mapper/<device>" -> "_mapper_<device>" 63: dev="_mapper_`echo $device | /bin/sed "s/\/dev\/mapper\///"`" 64: elif [ "`echo $device | /bin/grep "/dev/disk/by-id/"`" != "" ] 65: then 66: # "/dev/disk/by-id/<device>" -> "_by-id_<device>" 67: dev="_by-id_`echo $device | /bin/sed "s/\/dev\/disk\/by-id\///"`" 68: elif [ "`echo $device | /bin/grep "/dev/disk/by-path/"`" != "" ] 69: then 70: # "/dev/disk/by-path/<device>" -> "_by-path_<device>" 71: dev="_by-path_`echo $device | /bin/sed "s/\/dev\/disk\/by-path\///"`" 72: else 73: exit 0 74: fi 75: post_file="/etc/opt/FJSVswsts"$swstg_node"/data/DEFAULT/"$dev".pre" 76: 77: if [ "`echo $device | /bin/grep "/dev/disk/by-id/"`" != "" \ 78: -o "`echo $device | /bin/grep "/dev/disk/by-path/"`" != "" ] 79: then 80: cdevice="/dev/`/usr/bin/readlink $device | /bin/sed "s/..\/..\///"`" 81: cur_mount_point=`/bin/mount | grep "$cdevice " | cut -f3 -d' '` 82: else 83: cur_mount_point=`/bin/mount | grep "$device " | cut -f3 -d' '` 84: fi 85: if [ "$cur_mount_point" != "" ] 86: then 87: 88: if [ `/bin/cat /proc/mounts |/bin/cut -d' ' -f 2|/bin/grep "^$cur_mount_point\$"|/usr/bin/wc -w` != 1 ]; then 89: # stack mount (multi device on $cur_mount_point) 90: /bin/mount > $err_log_path/$dev.umount 2>&1 91: exit 13 92: fi 93: if [ `/bin/cat /proc/mounts |/bin/cut -d' ' -f 1|/bin/grep "^$device\$"|/usr/bin/wc -w` != 1 ]; then 94: cdevice="/dev/`/usr/bin/readlink $device | /bin/sed "s/..\/..\///"`" 95: if [ `/bin/cat /proc/mounts |/bin/cut -d' ' -f 1|/bin/grep "^$cdevice\$"|/usr/bin/wc -w` != 1 ]; then 96: # bind mount (device has multi mount point) 97: /bin/mount > $err_log_path/$dev.umount 2>&1 98: exit 13 99: fi 100: fi 101: 102: /bin/umount $cur_mount_point 2>/dev/null 103: if [ $? != 0 ] 104: then 105: retry_count=3 106: sleep_time=1 107: result_flag=1 108: 109: while [ $retry_count -gt 0 ] 110: do 111: /bin/umount $cur_mount_point > $err_log_path/$dev.umount 2>&1 112: if [ $? != 0 ] 113: then 114: retry_count=`expr $retry_count - 1` 115: /bin/sleep $sleep_time 116: else 117: /bin/rm -f $err_log_path/$dev.umount 118: result_flag=0 119: break 120: fi 121: done 122: 123: if [ $result_flag != 0 ] 124: then 125: /sbin/fuser -vum $cur_mount_point> $err_log_path/$dev.fuser 2>&1 126: /bin/ps -ef > $err_log_path/$dev.ps 2>&1 127: 128: exit 10 129: fi 130: fi 131: echo "mount" > $post_file 132: 133: # When device was not mounted 134: # 135: else 136: echo "none" > $post_file 137: fi 138: 139: exit 0 |