リスト実行時の後処理のシェルスクリプト名は、以下のとおりです。
クラスタ運用でない場合
/etc/opt/FJSVswsts/sh/OpcRestore.post |
クラスタ運用の場合
/etc/opt/FJSVswsts/logicalNodeName/sh/OpcRestore.post |
リストア時の後処理シェルスクリプト(OpcRestore.post)
Red Hat Enterprise Linux 8、Red Hat Enterprise Linux 7、またはRed Hat Enterprise Linux 6の場合
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 0SUSE Linux Enterprise Server 15またはSUSE Linux Enterprise Server 12の場合
1: #!/bin/sh
2:
3: # AdvancedCopy Manager
4: # All Rights Reserved, Copyright FUJITSU LIMITED, 2002-2011
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/FJSV"`" != "" ]
45: then
46: # /dev/FJSVmphd/dsk/mplb?s? -> mplb?s?
47: # /dev/FJSVmphd/dsk/mphd?s? -> mphd?s?
48: dev="`echo $device | /usr/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 | /usr/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: devnam="`echo $device | /usr/bin/cut -d: -f2-`"
59:
60: if [ "`echo $devnam | /bin/grep "/dev/disk/by-id/"`" != "" ]
61: then
62: # /dev/sfdsk/class/dsk/volume:/dev/disk/by-id/<device> -> class_volume__by_id_<device>
63: dev="`echo $dev | /bin/sed "s/\/dev\/disk\/by-id\//_by-id_/"`"
64: elif [ "`echo $devnam | /bin/grep "/dev/disk/by-path/"`" != "" ]
65: then
66: # /dev/sfdsk/class/dsk/volume:/dev/disk/by-path/<device> -> class_volume__by_path_<device>
67: dev="`echo $dev | /bin/sed "s/\/dev\/disk\/by-path\//_by-path_/"`"
68: fi
69: else
70: # /dev/sfdsk/class/dsk/volume -> _gds_class_volume
71: dev="_gds_`echo $device | /bin/sed "s/\/dev\/sfdsk\///"`"
72: dev="`echo $dev | /bin/sed "s/\/dsk\//_/"`"
73: fi
74: elif [ "`echo $device | /bin/grep "/dev/vx/dmp/"`" != "" ]
75: then
76: # /dev/vx/dmp/device -> _vx_pv_device
77: dev="_vx_pv_`echo $device | /bin/sed "s/\/dev\/vx\/dmp\///"`"
78: elif [ "`echo $device | /bin/grep "/dev/mapper/"`" != "" ]
79: then
80: # "/dev/mapper/<device>" -> "_mapper_<device>"
81: dev="_mapper_`echo $device | /bin/sed "s/\/dev\/mapper\///"`"
82: elif [ "`echo $device | /bin/grep "/dev/disk/by-id/"`" != "" ]
83: then
84: # "/dev/disk/by-id/<device>" -> "_by-id_<device>"
85: dev="_by-id_`echo $device | /bin/sed "s/\/dev\/disk\/by-id\///"`"
86: elif [ "`echo $device | /bin/grep "/dev/disk/by-path/"`" != "" ]
87: then
88: # "/dev/disk/by-path/<device>" -> "_by-path_<device>"
89: dev="_by-path_`echo $device | /bin/sed "s/\/dev\/disk\/by-path\///"`"
90: else
91: exit 0
92: fi
93: post_file="/etc/opt/FJSVswsts"$swstg_node"/data/DEFAULT/"$dev".pre"
94: fstype_file="/etc/opt/FJSVswsts"$swstg_node"/data/DEFAULT/"$dev".fstype"
95:
96: # Confirmation of postprocessing
97: if [ ! -r $post_file ]
98: then
99: exit 0
100: fi
101: post="`/bin/cat $post_file`"
102:
103: # Confirmation of FStype
104: if [ ! -r $fstype_file ]
105: then
106: fs=""
107: else
108: fs="`/bin/cat $fstype_file`"
109: fi
110:
111: # No processing
112: if [ "$post" = "none" ]
113: then
114: /bin/rm -rf $post_file 2> /dev/null
115: /bin/rm -rf $fstype_file 2> /dev/null
116: exit 0
117: fi
118:
119: # mount processing
120: if [ "$post" = "mount" ]
121: then
122: if [ "`echo $device | /bin/grep "/dev/disk/by-id/"`" != "" \
123: -o "`echo $device | /bin/grep "/dev/disk/by-path/"`" != "" ]
124: then
125: cdevice="/dev/`/usr/bin/readlink $device | /bin/sed "s/..\/..\///"`"
126: Result="`/bin/df -l | /bin/grep "$cdevice " | /bin/awk 'END {print NR}'`"
127: else
128: Result="`/bin/df -l | /bin/grep "$device " | /bin/awk 'END {print NR}'`"
129: fi
130: if [ "$Result" != "1" ]
131: then
132: if [ ! -r $fstype_file ]
133: then
134: /bin/mount $device $mount_point 2> /dev/null
135: else
136: Result1="`echo $fs | /bin/awk 'END {print NR}'`"
137: if [ "$Result1" != "1" ]
138: then
139: /bin/mount $device $mount_point 2> /dev/null
140: else
141: /bin/mount -t $fs $device $mount_point 2> /dev/null
142: fi
143: fi
144: if [ $? != 0 ]
145: then
146: retry_count=3
147: sleep_time=1
148: result_flag=1
149:
150: while [ $retry_count -gt 0 ]
151: do
152: if [ ! -r $fstype_file ]
153: then
154: /bin/mount $device $mount_point > $err_log_path/$dev.mount 2>&1
155: else
156: Result1="`echo $fs | /bin/awk 'END {print NR}'`"
157: if [ "$Result1" != "1" ]
158: then
159: /bin/mount $device $mount_point > $err_log_path/$dev.mount 2>&1
160: else
161: /bin/mount -t $fs $device $mount_point > $err_log_path/$dev.mount 2>&1
162: fi
163: fi
164: if [ $? != 0 ]
165: then
166: retry_count=`expr $retry_count - 1`
167: /bin/sleep $sleep_time
168: else
169: /bin/rm -f $err_log_path/$dev.mount
170: result_flag=0
171: break
172: fi
173: done
174:
175: if [ $result_flag != 0 ]
176: then
177: exit 11
178: fi
179: fi
180: fi
181: /bin/rm -rf $post_file 2> /dev/null
182: /bin/rm -rf $fstype_file 2> /dev/null
183: exit 0
184: fi
185:
186: exit 0