Top
ETERNUS SF AdvancedCopy Manager 14.2 Operator's Guide

A.2.1 Pre-processing of backup

The name of a script file for pre-processing of a backup is as follows.

In the case of non-cluster operation
/etc/opt/FJSVswsts/sh/OpcBackup.pre
In the case of cluster operation
/etc/opt/FJSVswsts/<logic node name>/sh/OpcBackup.pre

A.2.1.1 Pre-processing script for backup

  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 or VG name of transaction disk
 10: #                 $2 Mount point of transaction disk
 11: #                 $3 Device or VG name of backup disk
 12: #
 13: #  Error number
 14: #               2: Argument error
 15: #              10: umount error
 16: #              30: VG configuration file not found error
 17: #              99: Script not customize
 18: 
 19: 
 20: # Argument check
 21: case $# in
 22: 1)
 23:    ;;
 24: 2)
 25:    ;;
 26: 3)
 27:    ;;
 28: *)
 29:    exit 2
 30:    ;;
 31: esac
 32: 
 33: device=$1
 34: mount_point=$2
 35: bk_device=$3
 36: 
 37: # Determination postprocessing file name
 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: # Device type check
 48: trans="`echo $device | /usr/bin/grep -e "/dev/dsk/" -e "/dev/disk/"`"
 49: lvmtrans="`echo $device | /usr/bin/grep "/dev/"`"
 50: vxpvtrans="`echo $device | /usr/bin/grep "/dev/vx/dmp/"`"
 51: if [ "$trans" != "" ]
 52: then
 53:    dev_type="physical"
 54:    dev="`echo $device | /usr/bin/sed -e "s/\/dev\/dsk\///" -e "s/\/dev\/disk\//_hppv_/"`"
 55:    post_file="/etc/opt/FJSVswsts"$swstg_node"/data/DEFAULT/"$dev".pre"
 56:    fstype_file="/etc/opt/FJSVswsts"$swstg_node"/data/DEFAULT/"$dev".fstype"
 57:    bd_file="/etc/opt/FJSVswsts"$swstg_node"/data/DEFAULT/"$dev".bd"
 58: elif [ "$vxpvtrans" != "" ]
 59: then
 60:    dev_type="vxvm_pv"
 61:    # /dev/vx/dmp/XXXX -> XXXX
 62:    dev="`echo $device | /usr/bin/awk -F\/ '{ print $5 }'`"
 63:    post_file="/etc/opt/FJSVswsts"$swstg_node"/data/DEFAULT/"$dev".pre"
 64:    fstype_file="/etc/opt/FJSVswsts"$swstg_node"/data/DEFAULT/"$dev".fstype"
 65:    bd_file="/etc/opt/FJSVswsts"$swstg_node"/data/DEFAULT/"$dev".bd"
 66: elif [ "$lvmtrans" != "" ]
 67: then
 68:    dev_type="logical"
 69:    # /dev/XXXX -> XXXX
 70:    dev="`echo $device | /usr/bin/awk -F\/ '{ print $3 }'`"
 71:    post_file="/etc/opt/FJSVswsts"$swstg_node"/data/DEFAULT/"$dev".pre"
 72:    fstype_file="/etc/opt/FJSVswsts"$swstg_node"/data/DEFAULT/"$dev".fstype"
 73:    bd_file="/etc/opt/FJSVswsts"$swstg_node"/data/DEFAULT/"$dev".bd"
 74: else
 75:    exit 0
 76: fi
 77: 
 78: # Save VG name of backup disk
 79: bk_trans="`echo $bk_device | /usr/bin/grep -e "/dev/dsk/" -e "/dev/disk/"`"
 80: bk_lvmtrans="`echo $bk_device | /usr/bin/grep "/dev/"`"
 81: bk_vxpvtrans="`echo $bk_device | /usr/bin/grep "/dev/vx/dmp/"`"
 82: if [ "$bk_trans" = "" -a "$bk_lvmtrans" != "" -a "$bk_vxpvtrans" = "" ]
 83: then
 84:    bk_vg_name="`echo $bk_device | /usr/bin/awk -F\/ '{ print $3 }'`"
 85:    cfg_file="/etc/lvmconf/"$bk_vg_name".conf"
 86:    if [ ! -r $cfg_file ]
 87:    then
 88:            exit 30
 89:    fi
 90:    echo $bk_device > $bd_file
 91: fi
 92: 
 93: # When the transaction disk is a physical device #############################
 94: if [ "$dev_type" = "physical" ]
 95: then
 96: 
 97:    if [ "$mount_point" != "" ]
 98:    then
 99: # When device cannot be unmounted --- 1
100: #
101: #      if [ "$device" = "/dev/dsk/cXtXdX" ]
102: #      then
103: #         if [ "$bk_device" != "" ]
104: #         then
105: #            echo $bk_device > $bd_file
106: #         fi
107: #         df -ln $mount_point 2>/dev/null | awk -F: '{ print $2 }' | awk '{ print $1 }' > $fstype_file
108: #         sync
109: #         sync
110: #         echo "fsck" > $post_file
111: #
112: # When device can be unmounted --- 2
113: #      else
114:          /usr/bin/df -ln $mount_point 2>/dev/null | /usr/bin/awk -F: '{ print $2 }' | /usr/bin/awk '{ print $1 }' > $fstype_file
115:          /usr/sbin/umount $mount_point 2>/dev/null
116:          if [ $? != 0 ]
117:          then
118:             retry_count=3
119:             sleep_time=1
120:             result_flag=1
121: 
122:             while [ $retry_count -gt 0 ]
123:             do
124:                /usr/sbin/umount $mount_point > $err_log_path/$dev.umount 2>&1
125:                if [ $? != 0 ]
126:                then
127:                   retry_count=`expr $retry_count - 1`
128:                   /usr/bin/sleep $sleep_time
129:                else
130:                   result_flag=0
131:                   break
132:                fi
133:             done
134: 
135:             if [ $result_flag != 0 ]
136:             then
137:                /usr/sbin/fuser -cu $mount_point> $err_log_path/$dev.fuser 2>&1 
138:                /usr/bin/ps -ef > $err_log_path/$dev.ps 2>&1 
139: 
140:                exit 10
141:             else
142:                /usr/bin/rm -f $err_log_path/$dev.umount
143:             fi
144:          fi
145:          echo "mount" > $post_file
146: #      fi
147: # When device was not mounted --- 3
148: #
149:    else
150:       echo "none" > $post_file
151:    fi
152: 
153: # When the transaction disk is a volume group ################################
154: elif [ "$dev_type" = "logical" ]
155: then
156: 
157: # Devices is volume group and script not customize
158:exit 99
159: 
160: # When devices of volume group cannot be unmounted --- 4
161: #
162: #  # Specify the name of volume group not to unmount
163: #  if [ "$device" = "/dev/vgXX" ]
164: #  then
165: #     if [ "$bk_device" != "" ]
166: #     then
167: #        echo $bk_device > $bd_file
168: #     fi
169: #     sync
170: #     sync
171: #     echo "fsck" > $post_file
172: #  fi
173: #
174: # When devices of volume group can be unmounted --- 5
175: #
176: #  # Specify the name of volume group to unmount
177: #  if [ "$device" = "/dev/vgXX" ]
178: #  then
179: #     # Unmount all logical volumes of the volume group
180: #     mount_point="/XX"
181: #     /usr/sbin/umount $mount_point 2>/dev/null
182: #     if [ $? != 0 ]
183: #     then
184: #        retry_count=3
185: #        sleep_time=1
186: #        result_flag=1
187: #
188: #        while [ $retry_count -gt 0 ]
189: #        do
190: #
191: #           # $dev is volume group name
192: #
193: #           /usr/sbin/umount $mount_point > $err_log_path/$dev.umount 2>&1
194: #           if [ $? != 0 ]
195: #           then
196: #              retry_count=`expr $retry_count - 1`
197: #              sleep $sleep_time
198: #           else
199: #              rm -f $err_log_path/$dev.umount
200: #              result_flag=0
201: #              break
202: #           fi
203: #        done
204: #
205: #        if [ $result_flag != 0 ]
206: #        then
207: #           /usr/sbin/fuser -cu $mount_point> $err_log_path/$dev.fuser 2>&1 
208: #           /usr/bin/ps -ef > $err_log_path/$dev.ps 2>&1 
209: #
210: #           exit 10
211: #        fi
212: #     fi
213: #     echo "mount" > $post_file
214: #  fi
215: #
216: # When devices of volume group was not mounted --- 6
217: #
218: #  # Specify the name of volume group to do nothing
219: #  if [ "$device" = "/dev/vgXX" ]
220: #  then
221: #     echo "none" > $post_file
222: #  fi
223: #
224: # When the transaction disk is a VxVM physical volume --- 7 #################
225: elif [ "$dev_type" = "vxvm_pv" ]
226: then
227:    # Nothing is done to VxVM PV. 
228:    echo "none" > $post_file
229: fi
230: 
231: exit 0