ページの先頭行へ戻る
ETERNUS SF AdvancedCopy Manager 15.3 運用ガイド
ETERNUS

A.2.1 バックアップ実行時の前処理

バックアップ実行時の前処理のシェルスクリプト名は、以下のとおりです。

シェルスクリプトの内容は、以下のとおりです。

  1: #!/bin/sh
  2: 
  3: # AdvancedCopy Manager
  4: # All Rights Reserved, Copyright FUJITSU LIMITED, 2004-2007
  5: 
  6: #
  7: #   Pre-processing of backup processing
  8: #
  9: #       Argument: $1 Device or VG name of transaction disk
 10: #                 $2 Reserve
 11: #                 $3 Device or VG name of backup disk
 12: #
 13: #       Error number
 14: #               2: Argument error
 15: #              10: umount error
 16: #              50: varyoff error
 17: #              99: Script not customize
 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=$1
 33: bk_device=$3
 34: 
 35: if [ "$SWSTGNODE" != "" ]
 36: then
 37:         swstg_node="/`echo $SWSTGNODE`"
 38: else
 39:         swstg_node=""
 40: fi
 41: 
 42: err_log_path="/var/opt/FJSVswsts"$swstg_node"/log"
 43: 
 44: # Determination of postprocessing file name
 45: if [ "`echo $device | /usr/bin/grep "/dev/hdisk"`" != "" ]
 46: then
 47:     dev_type="lvm_pv"
 48:     # /dev/hdisk? -> hdisk?
 49:     dev="`echo $device | /usr/bin/awk -F\/ '{ print $3 }'`"
 50: 
 51: elif [ "`echo $device | /usr/bin/grep "/dev/vx/dmp/"`" != "" ]
 52: then
 53:     dev_type="vxvm_pv"
 54:     # /dev/vx/dmp/device -> device
 55:     dev="`echo $device | /usr/bin/awk -F\/ '{ print $5 }'`"
 56: 
 57: elif [ "`echo $device | /usr/bin/grep "/dev/"`" != "" ]
 58: then
 59:     dev_type="lvm_vg"
 60:     # /dev/VG_Name -> VG_Name
 61:     dev="`echo $device | /usr/bin/awk -F\/ '{ print $3 }'`"
 62: 
 63: else
 64:     # Other Volume
 65:     exit 0
 66: fi
 67: 
 68: post_file="/etc/opt/FJSVswsts"$swstg_node"/data/DEFAULT/"$dev".pre"
 69: 
 70: # When the transaction disk is a volume group #############################
 71: if [ "$dev_type" = "lvm_vg" ]
 72: then
 73: 
 74:         # Devices are volume group and script not customize
 75:         exit 99
 76: 
 77:         # When devices of volume group can be unmounted
 78:         # Specify the name of volume group to unmount
 79:         if [ "$device" = "/dev/vgXX" ]
 80:         then
 81:                 echo "mount" > $post_file
 82: 
 83:                 # Unmount all logical volumes of the volume group
 84:                 mount_point="/XX"
 85:                 /usr/sbin/umount $mount_point 2>/dev/null
 86:                 if [ $? != 0 ]
 87:                 then
 88:                     retry_count=3
 89:                     sleep_time=1
 90:                     result_flag=1
 91: 
 92:                     while [ $retry_count -gt 0 ]
 93:                     do
 94:                         /usr/sbin/umount $mount_point > $err_log_path/$dev.umount 2>&1
 95:                         if [ $? != 0 ]
 96:                         then
 97:                             retry_count=`expr $retry_count - 1`
 98:                             /usr/bin/sleep $sleep_time
 99:                         else
100:                             /usr/bin/rm -f $err_log_path/$dev.umount
101:                             result_flag=0
102:                             break
103:                         fi
104:                     done
105: 
106:                     if [ $result_flag != 0 ]
107:                     then
108:                         /usr/sbin/fuser -cu $mount_point> $err_log_path/$dev.fuser 2>&1 
109:                         /usr/bin/ps -ef > $err_log_path/$dev.ps 2>&1 
110: 
111:                         exit 10
112:                     fi
113:                 fi
114: 
115: #                mount_point="/XX"
116: #                /usr/sbin/umount $mount_point 2>/dev/null
117: #                if [ $? != 0 ]
118: #                then
119: #                    /usr/sbin/umount $mount_point > $err_log_path/$dev.umount 2>&1
120: #                    if [ $? != 0 ]
121: #                        retry_count=3
122: #                        sleep_time=1
123: #                        result_flag=1
124: #
125: #                        while [ $retry_count -gt 0 ]
126: #                        do
127: #                            /usr/sbin/umount $mount_point > $err_log_path/$dev.umount 2>&1
128: #                            if [ $? != 0 ]
129: #                            then
130: #                                retry_count=`expr $retry_count - 1`
131: #                                sleep $sleep_time
132: #                            else
133: #                                rm -f $err_log_path/$dev.umount
134: #                                result_flag=0
135: #                                break
136: #                            fi
137: #                        done
138: #
139: #                        if [ $result_flag != 0 ]
140: #                        then
141: #                            /usr/sbin/fuser -cu $mount_point> $err_log_path/$dev.fuser 2>&1 
142: #                            /usr/bin/ps -ef > $err_log_path/$dev.ps 2>&1 
143: #
144: #                            exit 10
145: #                        fi
146: #                    fi
147: #                fi
148:         fi
149: 
150:         # varyoff the backup volume.
151:         BKVOL=`/usr/bin/basename $bk_device`
152:         ACTIVE_VGS=`/usr/sbin/lsvg -o`
153:         for i in $ACTIVE_VGS
154:         do
155:                 if [ "$BKVOL" = "$i" ]
156:                 then
157:                         /usr/sbin/varyoffvg $i 2> /dev/null
158:                         if [ $? != 0 ]
159:                         then
160:                             /usr/sbin/varyoffvg $i > $err_log_path/$dev.varyoffvg 2>&1
161:                             if [ $? != 0 ]
162:                             then
163:                                 exit 50
164:                             else
165:                                 /usr/bin/rm -f $err_log_path/$dev.varyoffvg
166:                             fi
167:                         fi
168:                         break
169:                 fi
170:         done
171: 
172: # When the transaction disk is a VxVM physical volume #########################
173: elif [ "$dev_type" = "vxvm_pv" ]
174: then
175:         # Nothing is done to VxVM physical volume. 
176:         echo "none" > $post_file
177: 
178: # When the transaction disk is a LVM physical volume ##########################
179: elif [ "$dev_type" = "lvm_pv" ]
180: then
181:         # Nothing is done to LVM physical volume. 
182:         echo "none" > $post_file
183: 
184: fi
185: exit 0