テープコピー実行時の前処理のシェルスクリプト名は、以下のとおりです。
非クラスタ運用の場合
/etc/opt/FJSVswsts/sh/TapeCopy.pre |
クラスタ運用の場合
/etc/opt/FJSVswsts/<論理ノード名>/sh/TapeCopy.pre |
シェルスクリプトの内容は、以下のとおりです。
1: #!/bin/sh 2: 3: # AdvancedCopy Manager 4: # Copyright FUJITSU LIMITED, 2005-2012 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/vd"`" != "" ] 47: then 48: # /dev/vd? -> vd? 49: dev="`echo $device | /bin/sed "s/\/dev\///"`" 50: elif [ "`echo $device | /bin/grep "/dev/FJSV"`" != "" ] 51: then 52: # /dev/FJSVmphd/dsk/mplb?s? -> mplb?s? 53: # /dev/FJSVmphd/dsk/mphd?s? -> mphd?s? 54: dev="`echo $device | /bin/cut -d/ -f5`" 55: elif [ "`echo $device | /bin/grep "/dev/sfdsk/"`" != "" ] 56: then 57: # /dev/sfdsk/class/dsk/volume -> _gds_class_volume 58: dev="_gds_`echo $device | /bin/sed "s/\/dev\/sfdsk\///"`" 59: dev="`echo $dev | /bin/sed "s/\/dsk\//_/"`" 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/FJSVswsts"$swstg_node"/data/DEFAULT/"$dev".pre" 80: 81: if [ "`echo $device | /bin/grep "/dev/disk/by-id/"`" != "" \ 82: -o "`echo $device | /bin/grep "/dev/disk/by-path/"`" != "" ] 83: then 84: cdevice="/dev/`/usr/bin/readlink $device | /bin/sed "s/..\/..\///"`" 85: cur_mount_point=`/bin/mount | grep "$cdevice " | cut -f3 -d' '` 86: else 87: cur_mount_point=`/bin/mount | grep "$device " | cut -f3 -d' '` 88: fi 89: if [ "$cur_mount_point" != "" ] 90: then 91: 92: if [ `/bin/cat /proc/mounts |/bin/cut -d' ' -f 2|/bin/grep "^$cur_mount_point\$"|/usr/bin/wc -w` != 1 ]; then 93: # stack mount (multi device on $cur_mount_point) 94: /bin/mount > $err_log_path/$dev.umount 2>&1 95: exit 13 96: fi 97: if [ `/bin/cat /proc/mounts |/bin/cut -d' ' -f 1|/bin/grep "^$device\$"|/usr/bin/wc -w` != 1 ]; then 98: cdevice="/dev/`/usr/bin/readlink $device | /bin/sed "s/..\/..\///"`" 99: if [ `/bin/cat /proc/mounts |/bin/cut -d' ' -f 1|/bin/grep "^$cdevice\$"|/usr/bin/wc -w` != 1 ]; then 100: # bind mount (device has multi mount point) 101: /bin/mount > $err_log_path/$dev.umount 2>&1 102: exit 13 103: fi 104: fi 105: 106: /bin/umount $cur_mount_point 2>/dev/null 107: if [ $? != 0 ] 108: then 109: retry_count=3 110: sleep_time=1 111: result_flag=1 112: 113: while [ $retry_count -gt 0 ] 114: do 115: /bin/umount $cur_mount_point > $err_log_path/$dev.umount 2>&1 116: if [ $? != 0 ] 117: then 118: retry_count=`expr $retry_count - 1` 119: /bin/sleep $sleep_time 120: else 121: /bin/rm -f $err_log_path/$dev.umount 122: result_flag=0 123: break 124: fi 125: done 126: 127: if [ $result_flag != 0 ] 128: then 129: /sbin/fuser -vum $cur_mount_point> $err_log_path/$dev.fuser 2>&1 130: /bin/ps -ef > $err_log_path/$dev.ps 2>&1 131: 132: exit 10 133: fi 134: fi 135: echo "mount" > $post_file 136: 137: # When device was not mounted 138: # 139: else 140: echo "none" > $post_file 141: fi 142: 143: exit 0 |