The name of a script file for post-processing of a restoration is as follows.
/etc/opt/FJSVswsts/sh/OpcRestore.post
/etc/opt/FJSVswsts/<logic node name>/sh/OpcRestore.post
1: #!/bin/sh
2:
3: # AdvancedCopy Manager
4: # All Rights Reserved, Copyright FUJITSU LIMITED, 2002-2009
5:
6: #
7: # Post-processing of restoration processing
8: #
9: # Argument: $1 Device or VG name of transaction disk
10: # $2 Mount point of transaction disk
11: #
12: # Error number
13: # 2: Argument error
14: # 11: mount error
15: # 31: vfcfgrestore error
16: # 12: fsck error
17:
18: # Argument check
19: case $# in
20: 1)
21: ;;
22: 2)
23: ;;
24: *)
25: exit 2
26: ;;
27: esac
28:
29: device=$1
30: mount_point=$2
31:
32: # Determination of postprocessing file name
33:
34: if [ "$SWSTGNODE" != "" ]
35: then
36: swstg_node="/`echo $SWSTGNODE`"
37: else
38: swstg_node=""
39: fi
40:
41: err_log_path="/var/opt/FJSVswsts"$swstg_node"/log"
42:
43: trans="`echo $device | /usr/bin/grep -e "/dev/dsk/" -e "/dev/disk/"`"
44: lvmtrans="`echo $device | /usr/bin/grep "/dev/"`"
45: vxpvtrans="`echo $device | /usr/bin/grep "/dev/vx/dmp/"`"
46: if [ "$trans" != "" ]
47: then
48: dev_type="physical"
49: dev="`echo $device | /usr/bin/sed -e "s/\/dev\/dsk\///" -e "s/\/dev\/disk\//_hppv_/"`"
50: post_file="/etc/opt/FJSVswsts"$swstg_node"/data/DEFAULT/"$dev".pre"
51: fstype_file="/etc/opt/FJSVswsts"$swstg_node"/data/DEFAULT/"$dev".fstype"
52: elif [ "$vxpvtrans" != "" ]
53: then
54: dev_type="vxvm_pv"
55: # /dev/vx/dmp/XXXX -> XXXX
56: dev="`echo $device | /usr/bin/awk -F\/ '{ print $5 }'`"
57: post_file="/etc/opt/FJSVswsts"$swstg_node"/data/DEFAULT/"$dev".pre"
58: fstype_file="/etc/opt/FJSVswsts"$swstg_node"/data/DEFAULT/"$dev".fstype"
59: elif [ "$lvmtrans" != "" ]
60: then
61: dev_type="logical"
62: # /dev/vgXX -> vgXX
63: dev="`echo $device | /usr/bin/awk -F\/ '{ print $3 }'`"
64: post_file="/etc/opt/FJSVswsts"$swstg_node"/data/DEFAULT/"$dev".pre"
65: fstype_file="/etc/opt/FJSVswsts"$swstg_node"/data/DEFAULT/"$dev".fstype"
66: else
67: exit 0
68: fi
69:
70: # Confirmation of postprocessing
71: if [ ! -r $post_file ]
72: then
73: exit 0
74: fi
75: post="`/usr/bin/cat $post_file`"
76:
77: # Confirmation of FStype
78: if [ ! -r $fstype_file ]
79: then
80: fs=""
81: else
82: fs="`/usr/bin/cat $fstype_file`"
83: fi
84:
85: # Restore VG Configuration
86: if [ "$dev_type" = "logical" ]
87: then
88: vg_name="`echo $device | /usr/bin/awk -F\/ '{ print $3 }'`"
89: cfg_file="/etc/lvmconf/"$vg_name".conf"
90: if [ ! -r $cfg_file ]
91: then
92: exit 31
93: fi
94: pv_rname="`/usr/sbin/vgcfgrestore -n $device -l 2> /dev/null | /usr/bin/awk '{print $1}' | /usr/bin/grep -e \"/dev/rdsk\" -e \"/dev/rdisk\"`"
95: if [ "$pv_rname" = "" ]
96: then
97: echo "NULL: /usr/sbin/vgcfgrestore -n $device -l 2> /dev/null | /usr/bin/awk '{print $1}' | /usr/bin/grep -e \"/dev/rdsk\" -e \"/dev/rdisk\"" > $err_log_path/$dev.vgcfgrestore 2>&1
98: exit 31
99: fi
100: /usr/sbin/vgchange -a n $device > /dev/null 2>&1
101: reststatus=0
102: for pv_rname1 in $pv_rname
103: do
104: /usr/sbin/vgcfgrestore -n $device $pv_rname1 > /dev/null 2>&1
105: if [ $? != 0 ]
106: then
107: /usr/sbin/vgcfgrestore -n $device $pv_rname1 >> $err_log_path/$dev.vgcfgrestore 2>&1
108: fi
109: if [ $? = 0 ]
110: then
111: /usr/bin/rm -f $err_log_path/$dev.vgcfgrestore
112: reststatus=1
113: break
114: fi
115: done
116: if [ "$SWSTGNODE" != "" ]
117: then
118: /usr/sbin/vgchange -c y $device > /dev/null 2>&1
119: /usr/sbin/vgchange -a e $device > /dev/null 2>&1
120: else
121: /usr/sbin/vgchange -a y $device > /dev/null 2>&1
122: fi
123: if [ $reststatus = 0 ]
124: then
125: exit 31
126: fi
127: fi
128:
129: # No processing
130: # When device was not mounted --- 2
131: # When devices of volume group was not mounted --- 4
132: # When the transaction disk is a VxVM physical volume --- 5
133: if [ "$post" = "none" ]
134: then
135: /usr/bin/rm -rf $post_file 2> /dev/null
136: /usr/bin/rm -rf $fstype_file 2> /dev/null
137: exit 0
138: fi
139:
140: # mount processing
141: if [ "$post" = "mount" ]
142: then
143:
144: # When device was mounted --- 1
145: if [ "$dev_type" = "physical" ]
146: then
147: /usr/bin/df -l $device > /dev/null 2>&1
148: if [ $? != 0 ]
149: then
150: if [ ! -r $fstype_file ]
151: then
152: /usr/sbin/mount $device $mount_point 2> /dev/null
153: else
154: if [ "$fs" = "" ]
155: then
156: /usr/sbin/mount $device $mount_point 2> /dev/null
157: else
158: /usr/sbin/mount -F $fs $device $mount_point 2> /dev/null
159: fi
160: fi
161: if [ $? != 0 ]
162: then
163: retry_count=3
164: sleep_time=1
165: result_flag=1
166:
167: while [ $retry_count -gt 0 ]
168: do
169: if [ ! -r $fstype_file ]
170: then
171: /usr/sbin/mount $device $mount_point > $err_log_path/$dev.mount 2>&1
172: else
173: if [ "$fs" = "" ]
174: then
175: /usr/sbin/mount $device $mount_point > $err_log_path/$dev.mount 2>&1
176: else
177: /usr/sbin/mount -F $fs $device $mount_point > $err_log_path/$dev.mount 2>&1
178: fi
179: fi
180: if [ $? != 0 ]
181: then
182: retry_count=`expr $retry_count - 1`
183: /usr/bin/sleep $sleep_time
184: else
185: /usr/bin/rm -f $err_log_path/$dev.mount
186: result_flag=0
187: break
188: fi
189: done
190:
191: if [ $result_flag != 0 ]
192: then
193: exit 11
194: fi
195: fi
196: fi
197: # elif [ "$dev_type" = "logical" ]
198: # then
199: #
200: # When devices of volume group was mounted --- 3
201: # # Specify the name of volume group to mount
202: # if [ "$device" = "/dev/vgXX" ]
203: # then
204: # # Mount all logical volumes of the volume group
205: # fs="hfs"
206: # lvname="/dev/vgXX/XXXXX"
207: # lv_mount_point="/XX"
208: #
209: # fsck -F $fs -y $lvname > /dev/null 2>&1
210: # if [ $? != 0 ]
211: # then
212: # fsck -F $fs -y $lvname > $err_log_path/$dev.fsck 2>&1
213: # if [ $? != 0 ]
214: # then
215: # exit 12
216: # else
217: # rm -f $err_log_path/$dev.fsck
218: # fi
219: # fi
220: # /usr/bin/df -l $lvname > /dev/null 2>&1
221: # if [ $? != 0 ]
222: # then
223: # /usr/sbin/mount -F $fs $lvname $lv_mount_point 2> /dev/null
224: # if [ $? != 0 ]
225: # then
226: # retry_count=3
227: # sleep_time=1
228: # result_flag=1
229: #
230: # while [ $retry_count -gt 0 ]
231: # do
232: # /usr/sbin/mount -F $fs $lvname $lv_mount_point > $err_log_path/$dev.mount 2>&1
233: # if [ $? != 0 ]
234: # then
235: # retry_count=`expr $retry_count - 1`
236: # /usr/bin/sleep $sleep_time
237: # else
238: # rm -f $err_log_path/$dev.mount
239: # result_flag=0
240: # break
241: # fi
242: # done
243: #
244: # if [ $result_flag != 0 ]
245: # then
246: # exit 11
247: # fi
248: # fi
249: # fi
250: # fi
251: fi
252: /usr/bin/rm -rf $post_file 2> /dev/null
253: /usr/bin/rm -rf $fstype_file 2> /dev/null
254: exit 0
255: fi
256:
257: exit 0