Top
ETERNUS SF AdvancedCopy Manager 14.1 Operator's Guide

A.3.2 Post-processing of restoration

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

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

A.3.2.1 Post-processing script for restoration

  1: #!/bin/sh
  2:
  3: # AdvancedCopy Manager
  4: # All Rights Reserved, Copyright FUJITSU LIMITED, 2002-2009
  5: #
  6: #   Post-processing of restoration processing
  7: #
  8: #     Argument: $1 Device name of transaction disk
  9: #                            $2 Mount point of transaction disk
 10: #
 11: #  Error number
 12: #           2: Argument error
 13: #          11: mount error
 14:
 15: # Argument check
 16: case $# in
 17: 1)
 18:    ;;
 19: 2)
 20:    ;;
 21: *)
 22:    exit 2
 23:    ;;
 24: esac
 25:
 26: device="`echo $1`"
 27: mount_point="`echo $2`"
 28:
 29: # Determination of postprocessing file name
 30:
 31: if [ "$SWSTGNODE" != "" ]
 32: then
 33:    swstg_node="/`echo $SWSTGNODE`"
 34: else
 35:    swstg_node=""
 36: fi
 37:
 38: err_log_path="/var/opt/FJSVswsts"$swstg_node"/log"
 39:
 40: if [ "`echo $device | /bin/grep "/dev/sd"`" != "" ]
 41: then
 42:    # /dev/sd? -> sd?
 43:    dev="`echo $device | /bin/sed "s/\/dev\///"`"
 44: elif [ "`echo $device | /bin/grep "/dev/FJSV"`" != "" ]
 45: then
 46:    # /dev/FJSVmphd/dsk/mplb?s? -> mplb?s?
 47:    # /dev/FJSVmphd/dsk/mphd?s? -> mphd?s?
 48:    dev="`echo $device | /bin/cut -d/ -f5`"
 49: elif [ "`echo $device | /bin/grep "/dev/sfdsk/"`" != "" ]
 50: then
 51:    if [ "`echo $device | /bin/grep ":"`" != ""   ]
 52:    then
 53:       devnam="`echo $device | /bin/cut -d: -f2-`"
 54:       # /dev/sfdsk/class/dsk/volume:sd? -> class_volume_sd?
 55:       dev="`echo $device | /bin/sed "s/\/dev\/sfdsk\///"`"
 56:       dev="`echo $dev | /bin/sed "s/\/dsk\//_/"`"
 57:       dev="`echo $dev | /bin/sed "s/:/_/"`"
 58:       device="`echo $device | /bin/cut -d: -f1`"
 59:       if [ "`echo $devnam | /bin/grep "/dev/disk/by-id/"`" != "" ]
 60:       then
 61:          # /dev/sfdsk/class/dsk/volume:/dev/disk/by-id/<device> -> class_volume_by_id_<device>
 62:          dev="`echo $dev | /bin/sed "s/\/dev\/disk\/by-id\//_by-id_/"`"
 63:       elif [ "`echo $devnam | /bin/grep "/dev/disk/by-path/"`" != "" ]
 64:       then
 65:          # /dev/sfdsk/class/dsk/volume:/dev/disk/by-path/<device> -> class_volume_by_path_<device>
 66:          dev="`echo $dev | /bin/sed "s/\/dev\/disk\/by-path\//_by-path_/"`"
 67:       fi
 68:    else
 69:       # /dev/sfdsk/class/dsk/volume -> _gds_class_volume
 70:       dev="_gds_`echo $device | /bin/sed "s/\/dev\/sfdsk\///"`"
 71:       dev="`echo $dev | /bin/sed "s/\/dsk\//_/"`"
 72:    fi
 73: elif [ "`echo $device | /bin/grep "/dev/disk/by-id/"`" != "" ]
 74: then
 75:    # "/dev/disk/by-id/<device>" -> "_by-id_<device>"
 76:    dev="_by-id_`echo $device | /bin/sed "s/\/dev\/disk\/by-id\///"`"
 77: elif [ "`echo $device | /bin/grep "/dev/disk/by-path/"`" != "" ]
 78: then
 79:    # "/dev/disk/by-path/<device>" -> "_by-path_<device>"
 80:    dev="_by-path_`echo $device | /bin/sed "s/\/dev\/disk\/by-path\///"`"
 81: else
 82:    exit 0
 83: fi
 84: post_file="/etc/opt/FJSVswsts"$swstg_node"/data/DEFAULT/"$dev".pre"
 85: fstype_file="/etc/opt/FJSVswsts"$swstg_node"/data/DEFAULT/"$dev".fstype"
 86:
 87: # Confirmation of postprocessing
 88: if [ ! -r $post_file ]
 89: then
 90:    exit 0
 91: fi
 92: post="`/bin/cat $post_file`"
 93:
 94: # Confirmation of FStype
 95: if [ ! -r $fstype_file ]
 96: then
 97:    fs=""
 98: else
 99:    fs="`/bin/cat $fstype_file`"
100: fi
101:
102: # No processing
103: if [ "$post" = "none" ]
104: then
105:    /bin/rm -rf $post_file 2> /dev/null
106:    /bin/rm -rf $fstype_file 2> /dev/null
107:    exit 0
108: fi
109:
110: # mount processing
111: if [ "$post" = "mount" ]
112: then
113:    if [ "`echo $device | /bin/grep "/dev/disk/by-id/"`" != "" \
114:            -o "`echo $device | /bin/grep "/dev/disk/by-path/"`" != "" ]
115:    then
116:       cdevice="/dev/`/usr/bin/readlink $device | /bin/sed "s/..\/..\///"`"
117:       Result="`/bin/df -l | /bin/grep "$cdevice " | /bin/awk 'END {print NR}'`"
118:    else
119:       Result="`/bin/df -l | /bin/grep "$device " | /bin/awk 'END {print NR}'`"
120:    fi
121:  if [ "$Result" != "1" ]
122:    then
123:       if [ ! -r $fstype_file ]
124:       then
125:          /bin/mount $device $mount_point 2> /dev/null
126:       else
127:          Result1="`echo $fs | /bin/awk 'END {print NR}'`"
128:          if [ "$Result1" != "1" ]
129:          then
130:             /bin/mount $device $mount_point 2> /dev/null
131:          else
132:             /bin/mount -t $fs $device $mount_point 2> /dev/null
133:          fi
134:       fi
135:       if [ $? != 0 ]
136:       then
137:          retry_count=3
138:          sleep_time=1
139:          result_flag=1
140:
141:          while [ $retry_count -gt 0 ]
142:          do
143:             if [ ! -r $fstype_file ]
144:             then
145:                     /bin/mount $device $mount_point > $err_log_path/$dev.mount 2>&1
146:             else
147:                Result1="`echo $fs | /bin/awk 'END {print NR}'`"
148:                if [ "$Result1" != "1" ]
149:                then
150:                   /bin/mount $device $mount_point > $err_log_path/$dev.mount 2>&1
151:                else
152:                   /bin/mount -t $fs $device $mount_point > $err_log_path/$dev.mount 2>&1
153:                fi
154:             fi
155:             if [ $? != 0 ]
156:             then
157:                retry_count=`expr $retry_count - 1`
158:                /bin/sleep $sleep_time
159:             else
160:                /bin/rm -f $err_log_path/$dev.mount
161:                result_flag=0
162:                break
163:             fi
164:          done
165:
166:          if [ $result_flag != 0 ]
167:          then
168:             exit 11
169:          fi
170:       fi
171:    fi
172:    /bin/rm -rf $post_file 2> /dev/null
173:    /bin/rm -rf $fstype_file 2> /dev/null
174:    exit 0
175: fi
176:
177: exit 0