Top
ETERNUS SF AdvancedCopy Manager V16.9A Operation Guide
FUJITSU Storage

A.3.2 Post-processing of Restoration

The name of a script file for post-processing of a restoration is as follows.

/etc/opt/FJSVswsts/sh/OpcRestore.post

Post-processing Script for Restoration (OpcRestore.post)

  1: #!/bin/sh
  2: 
  3: # AdvancedCopy Manager
  4: # All Rights Reserved, Copyright FUJITSU LIMITED, 2004-2007
  5: 
  6: #
  7: #   Post-processing of restoration processing
  8: #
  9: #          Argument: $1 Device or VG name of transaction disk
 10: #                         $2 Reserve
 11: #
 12: #  Error number
 13: #               2: Argument error
 14: #              11: mount error
 15: #              51: varyon error
 16: 
 17: # Argument check
 18: case $# in
 19: 1)
 20:    ;;
 21: 2)
 22:    ;;
 23: *)
 24:    exit 2
 25:    ;;
 26: esac
 27: 
 28: device=$1
 29: 
 30: if [ "$SWSTGNODE" != "" ]
 31: then
 32:    swstg_node="/`echo $SWSTGNODE`"
 33: else
 34:    swstg_node=""
 35: fi
 36: 
 37: err_log_path="/var/opt/FJSVswsts"$swstg_node"/log"
 38: 
 39: # Determination of postprocessing file name
 40: if [ "`echo $device | /usr/bin/grep "/dev/hdisk"`" != "" ]
 41: then
 42:    dev_type="lvm_pv"
 43:    # /dev/hdisk? -> hdisk?
 44:    dev="`echo $device | /usr/bin/awk -F\/ '{ print $3 }'`"
 45: 
 46: elif [ "`echo $device | /usr/bin/grep "/dev/vx/dmp/"`" != "" ]
 47: then
 48:    dev_type="vxvm_pv"
 49:    # /dev/vx/dmp/device -> device
 50:    dev="`echo $device | /usr/bin/awk -F\/ '{ print $5 }'`"
 51: 
 52: elif [ "`echo $device | /usr/bin/grep "/dev/"`" != "" ]
 53: then
 54:    dev_type="lvm_vg"
 55:    # /dev/VG_Name -> VG_Name
 56:    dev="`echo $device | /usr/bin/awk -F\/ '{ print $3 }'`"
 57: 
 58: else
 59:    # Other Volume
 60:    exit 0
 61: fi
 62: 
 63: post_file="/etc/opt/FJSVswsts"$swstg_node"/data/DEFAULT/"$dev".pre"
 64: 
 65: if [ "$dev_type" = "lvm_vg" ]
 66: then
 67:    # varyon the transaction volume
 68:    /usr/sbin/varyonvg $dev 2> /dev/null
 69:    if [ $? != 0 ]
 70:    then
 71:       /usr/sbin/varyonvg $dev > $err_log_path/$dev.varyonvg 2>&1
 72:       if [ $? != 0 ]
 73:       then
 74:          exit 51
 75:       else
 76:          /usr/bin/rm -f $err_log_path/$dev.varyonvg
 77:       fi
 78:    fi
 79: fi
 80: 
 81: # Confirmation of postprocessing
 82: if [ ! -r $post_file ]
 83: then
 84:    exit 0
 85: fi
 86: post="`/usr/bin/cat $post_file`"
 87: 
 88: # mount processing
 89: if [ "$post" = "mount" ]
 90: then
 91: 
 92: # When devices of volume group was mounted
 93: # Specify the name of volume group to mount
 94: 
 95:    if [ "$device" = "/dev/vgXX" ]
 96:    then
 97:       mount_error=0
 98: 
 99:       # Mount all logical volumes of the volume group
100:       lvname="/dev/XXXXX"
101:       lv_mount_point="/XX"
102:       mount_status=`/usr/sbin/mount | /usr/bin/nawk -v lv=${lvname} 'lv==$1{flag=1; exit;} END{if(flag==1) print "mounted"; else print "not_mounted";}'`
103:       if [ $mount_status = "not_mounted" ]
104:       then
105:          /usr/sbin/mount $lvname $lv_mount_point 2> /dev/null
106:          if [ $? != 0 ]
107:          then
108:             retry_count=3
109:             sleep_time=1
110:             result_flag=1
111: 
112:             while [ $retry_count -gt 0 ]
113:             do
114:                /usr/sbin/mount $lvname $lv_mount_point > $err_log_path/$dev.mount 2>&1
115:                if [ $? != 0 ]
116:                then
117:                   retry_count=`expr $retry_count - 1`
118:                   /usr/bin/sleep $sleep_time
119:                else
120:                   /usr/bin/rm -f $err_log_path/$dev.mount
121:                   result_flag=0
122:                   break
123:                fi
124:             done
125: 
126:             if [ $result_flag != 0 ]
127:             then
128:                mount_error=1
129:             fi
130:          fi
131:       fi
132: 
133: #     lvname="/dev/XXXXX"
134: #     lv_mount_point="/XX"
135: #     mount_status=`/usr/sbin/mount | /usr/bin/nawk -v lv=${lvname} 'lv==$1{flag=1; exit;} END{if(flag==1) print "mounted"; else print "not_mounted";}'`
136: #     if [ $mount_status = "not_mounted" ]
137: #     then
138: #        /usr/sbin/mount $lvname $lv_mount_point 2> /dev/null
139: #        if [ $? != 0 ]
140: #        then
141: #           retry_count=3
142: #           sleep_time=1
143: #           result_flag=1
144: #
145: #           while [ $retry_count -gt 0 ]
146: #           do
147: #              /usr/sbin/mount $lvname $lv_mount_point > $err_log_path/$dev.mount 2>&1
148: #              if [ $? != 0 ]
149: #              then
150: #                 retry_count=`expr $retry_count - 1`
151: #                 /usr/bin/sleep $sleep_time
152: #              else
153: #                 rm -f $err_log_path/$dev.mount
154: #                 result_flag=0
155: #                 break
156: #              fi
157: #           done
158: #
159: #           if [ $result_flag != 0 ]
160: #           then
161: #              mount_error=1
162: #           fi
163: #        fi
164: #     fi
165: 
166:       if [ $mount_error != 0 ]
167:       then
168:          exit 11
169:       fi
170:    fi
171: fi
172: 
173: /usr/bin/rm -rf $post_file 2> /dev/null
174: exit 0