Top
ETERNUS SF AdvancedCopy Manager V15.0 Operation 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: # Copyright FUJITSU LIMITED, 2002-2012
  5: #
  6: #   Postprocessing 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/vd"`" != "" ]
 45: then
 46:    # /dev/vd? -> vd?
 47:    dev="`echo $device | /bin/sed "s/\/dev\///"`"
 48: elif [ "`echo $device | /bin/grep "/dev/FJSV"`" != "" ]
 49: then
 50:    # /dev/FJSVmphd/dsk/mplb?s? -> mplb?s?
 51:    # /dev/FJSVmphd/dsk/mphd?s? -> mphd?s?
 52:    dev="`echo $device | /bin/cut -d/ -f5`"
 53: elif [ "`echo $device | /bin/grep "/dev/sfdsk/"`" != "" ]
 54: then
 55:    if [ "`echo $device | /bin/grep ":"`" != ""   ]
 56:    then
 57:            devnam="`echo $device | /bin/cut -d: -f2-`"
 58:            # /dev/sfdsk/class/dsk/volume:sd? -> class_volume_sd?
 59:            dev="`echo $device | /bin/sed "s/\/dev\/sfdsk\///"`"
 60:            dev="`echo $dev | /bin/sed "s/\/dsk\//_/"`"
 61:            dev="`echo $dev | /bin/sed "s/:/_/"`"
 62:            device="`echo $device | /bin/cut -d: -f1`"
 63:            if [ "`echo $devnam | /bin/grep "/dev/disk/by-id/"`" != "" ]
 64:            then
 65:                    # /dev/sfdsk/class/dsk/volume:/dev/disk/by-id/<device> -> class_volume__by_id_<device>
 66:                    dev="`echo $dev | /bin/sed "s/\/dev\/disk\/by-id\//_by-id_/"`"
 67:            elif [ "`echo $devnam | /bin/grep "/dev/disk/by-path/"`" != "" ]
 68:            then
 69:                    # /dev/sfdsk/class/dsk/volume:/dev/disk/by-path/<device> -> class_volume__by_path_<device>
 70:                    dev="`echo $dev | /bin/sed "s/\/dev\/disk\/by-path\//_by-path_/"`"
 71:            fi
 72:    else
 73:            # /dev/sfdsk/class/dsk/volume -> _gds_class_volume
 74:            dev="_gds_`echo $device | /bin/sed "s/\/dev\/sfdsk\///"`"
 75:            dev="`echo $dev | /bin/sed "s/\/dsk\//_/"`"
 76:    fi
 77: elif [ "`echo $device | /bin/grep "/dev/vx/dmp/"`" != "" ]
 78: then
 79:    # /dev/vx/dmp/device -> _vx_pv_device
 80:    dev="_vx_pv_`echo $device | /bin/sed "s/\/dev\/vx\/dmp\///"`"
 81: elif [ "`echo $device | /bin/grep "/dev/mapper/"`" != "" ]
 82: then
 83:    # "/dev/mapper/<device>" -> "_mapper_<device>"
 84:    dev="_mapper_`echo $device | /bin/sed "s/\/dev\/mapper\///"`"
 85: elif [ "`echo $device | /bin/grep "/dev/disk/by-id/"`" != "" ]
 86: then
 87:    # "/dev/disk/by-id/<device>" -> "_by-id_<device>"
 88:    dev="_by-id_`echo $device | /bin/sed "s/\/dev\/disk\/by-id\///"`"
 89: elif [ "`echo $device | /bin/grep "/dev/disk/by-path/"`" != "" ]
 90: then
 91:    # "/dev/disk/by-path/<device>" -> "_by-path_<device>"
 92:    dev="_by-path_`echo $device | /bin/sed "s/\/dev\/disk\/by-path\///"`"
 93: else
 94:    exit 0
 95: fi
 96: post_file="/etc/opt/FJSVswsts"$swstg_node"/data/DEFAULT/"$dev".pre"
 97: fstype_file="/etc/opt/FJSVswsts"$swstg_node"/data/DEFAULT/"$dev".fstype"
 98: 
 99: # Confirmation of postprocessing
100: if [ ! -r $post_file ]
101: then
102:    exit 0
103: fi
104: post="`/bin/cat $post_file`"
105: 
106: # Confirmation of FStype
107: if [ ! -r $fstype_file ]
108: then
109:    fs=""
110: else
111:    fs="`/bin/cat $fstype_file`"
112: fi
113: 
114: # No processing
115: if [ "$post" = "none" ]
116: then
117:    /bin/rm -rf $post_file 2> /dev/null
118:    /bin/rm -rf $fstype_file 2> /dev/null
119:    exit 0
120: fi
121: 
122: # mount processing
123: if [ "$post" = "mount" ]
124: then
125:    if [ "`echo $device | /bin/grep "/dev/disk/by-id/"`" != "" \
126:            -o "`echo $device | /bin/grep "/dev/disk/by-path/"`" != "" ]
127:    then
128:            cdevice="/dev/`/usr/bin/readlink $device | /bin/sed "s/..\/..\///"`"
129:            Result="`/bin/df -l | /bin/grep "$cdevice " | /bin/awk 'END {print NR}'`"
130:    else
131:            Result="`/bin/df -l | /bin/grep "$device " | /bin/awk 'END {print NR}'`"
132:    fi
133:       if [ "$Result" != "1" ]
134:    then
135:            if [ ! -r $fstype_file ]
136:            then
137:                    /bin/mount $device $mount_point 2> /dev/null
138:            else
139:                    Result1="`echo $fs | /bin/awk 'END {print NR}'`"
140:                         if [ "$Result1" != "1" ]
141:                    then
142:                            /bin/mount $device $mount_point 2> /dev/null
143:                    else
144:                            /bin/mount -t $fs $device $mount_point 2> /dev/null
145:                    fi
146:            fi
147:            if [ $? != 0 ]
148:            then
149:                    retry_count=3
150:                    sleep_time=1
151:                    result_flag=1
152: 
153:                    while [ $retry_count -gt 0 ]
154:                    do
155:                            if [ ! -r $fstype_file ]
156:                            then
157:                                    /bin/mount $device $mount_point > $err_log_path/$dev.mount 2>&1
158:                            else
159:                                    Result1="`echo $fs | /bin/awk 'END {print NR}'`"
160:                                    if [ "$Result1" != "1" ]
161:                                    then
162:                                            /bin/mount $device $mount_point > $err_log_path/$dev.mount 2>&1
163:                                    else
164:                                            /bin/mount -t $fs $device $mount_point > $err_log_path/$dev.mount 2>&1
165:                                    fi
166:                            fi
167:                            if [ $? != 0 ]
168:                            then
169:                                    retry_count=`expr $retry_count - 1`
170:                                    /bin/sleep $sleep_time
171:                            else
172:                                    /bin/rm -f $err_log_path/$dev.mount
173:                                    result_flag=0
174:                                    break
175:                            fi
176:                    done
177: 
178:                    if [ $result_flag != 0 ]
179:                    then
180:                            exit 11
181:                    fi
182:            fi
183:    fi
184:    /bin/rm -rf $post_file 2> /dev/null
185:    /bin/rm -rf $fstype_file 2> /dev/null
186:    exit 0
187: fi
188: 
189: exit 0