後処理のシェルスクリプトには複写元ボリューム(RepSrc.Post)と複写先ボリューム(RepDst.Post)を用意し、以下のディレクトリ配下に格納されています。処理の必要性に応じてシェルスクリプトをカスタマイズしてください。
非クラスタ運用の場合
/etc/opt/FJSVswsrp/shディレクトリ配下 |
クラスタ運用の場合
/etc/opt/FJSVswsrp/<論理ノード名>/shディレクトリ配下 |
RepSrc.post(複写元ボリューム後処理のシェルスクリプト)
1: #!/bin/sh
2:
3: # AdvancedCopy Manager
4: # All Rights Reserved, Copyright FUJITSU LIMITED, 2002-2008
5:
6: #
7: # Post-processing of Replication(Source) processing
8: #
9: # Argument: $1 Device name of Source disk
10: #
11: # Error number
12: # 2: Argument error
13: # 11: mount error
14:
15: # Argument check
16: case $# in
17: 1)
18: ;;
19: *)
20: exit 2
21: ;;
22: esac
23:
24: device=$1
25:
26: # Determination of postprocessing file name
27: if [ "`echo $device | /bin/grep "/dev/sd"`" != "" ]
28: then
29: # /dev/sd? -> sd?
30: dev="`echo $device | /bin/sed "s/\/dev\///"`"
31: elif [ "`echo $device | /bin/grep "/dev/FJSV"`" != "" ]
32: then
33: # /dev/FJSVmphd/dsk/mplb?s? -> mplb?s?
34: # /dev/FJSVmphd/dsk/mphd?s? -> mphd?s?
35: dev="`echo $device | /bin/cut -d/ -f5`"
36: elif [ "`echo $device | /bin/grep "/dev/sfdsk/"`" != "" ]
37: then
38: if [ "`echo $device | /bin/grep ":"`" != "" ]
39: then
40: devnam="`echo $device | /bin/cut -d: -f2-`"
41: # /dev/sfdsk/class/dsk/volume:sd? -> class_volume_sd?
42: dev="`echo $device | /bin/sed "s/\/dev\/sfdsk\///"`"
43: dev="`echo $dev | /bin/sed "s/\/dsk\//_/"`"
44: dev="`echo $dev | /bin/sed "s/:/_/"`"
45: device="`echo $device | /bin/cut -d: -f1`"
46: if [ "`echo $devnam | /bin/grep "/dev/disk/by-id/"`" != "" ]
47: then
48: # /dev/sfdsk/class/dsk/volume:/dev/disk/by-id/<device> -> class_volume__by_id_<device>
49: dev="`echo $dev | /bin/sed "s/\/dev\/disk\/by-id\//_by-id_/"`"
50: elif [ "`echo $devnam | /bin/grep "/dev/disk/by-path/"`" != "" ]
51: then
52: # /dev/sfdsk/class/dsk/volume:/dev/disk/by-path/<device> -> class_volume__by_path_<device>
53: dev="`echo $dev | /bin/sed "s/\/dev\/disk\/by-path\//_by-path_/"`"
54: fi
55: else
56: # /dev/sfdsk/class/dsk/volume -> _gds_class_volume
57: dev="_gds_`echo $device | /bin/sed "s/\/dev\/sfdsk\///"`"
58: dev="`echo $dev | /bin/sed "s/\/dsk\//_/"`"
59: fi
60: elif [ "`echo $device | /bin/grep "/dev/disk/by-id/"`" != "" ]
61: then
62: # "/dev/disk/by-id/<device>" -> "_by-id_<device>"
63: dev="_by-id_`echo $device | /bin/sed "s/\/dev\/disk\/by-id\///"`"
64: elif [ "`echo $device | /bin/grep "/dev/disk/by-path/"`" != "" ]
65: then
66: # "/dev/disk/by-path/<device>" -> "_by-path_<device>"
67: dev="_by-path_`echo $device | /bin/sed "s/\/dev\/disk\/by-path\///"`"
68: else
69: exit 0
70: fi
71: post_file="/etc/opt/FJSVswsrp/"$SWSTGNODE"/data/DEFAULT/"$dev".spre"
72: fstype_file="/etc/opt/FJSVswsrp/"$SWSTGNODE"/data/DEFAULT/"$dev".sfstype"
73:
74: err_log_path="/var/opt/FJSVswsrp/"$SWSTGNODE"/log"
75:
76: # Confirmation of postprocessing
77: if [ ! -r $post_file ]
78: then
79: exit 0
80: fi
81: post="`/bin/cat $post_file | /bin/cut -d',' -f1`"
82: mount_point="`/bin/cat $post_file | /bin/cut -d',' -f2`"
83:
84: # Confirmation of FStype
85: if [ ! -r $fstype_file ]
86: then
87: fs=""
88: else
89: fs="`/bin/cat $fstype_file`"
90: fi
91:
92: # No processing
93: if [ "$post" = "none" ]
94: then
95: /bin/rm -rf $post_file 2> /dev/null
96: /bin/rm -rf $fstype_file 2> /dev/null
97: exit 0
98: fi
99:
100: # mount processing
101: if [ "$post" = "mount" ]
102: then
103: if [ "`echo $device | /bin/grep "/dev/disk/by-id/"`" != "" \
104: -o "`echo $device | /bin/grep "/dev/disk/by-path/"`" != "" ]
105: then
106: cdevice="/dev/`/usr/bin/readlink $device | /bin/sed "s/..\/..\///"`"
107: Result="`/bin/df -l | /bin/grep "$cdevice " | /bin/awk 'END {print NR}'`"
108: else
109: Result="`/bin/df -l | /bin/grep "$device " | /bin/awk 'END {print NR}'`"
110: fi
111: if [ "$Result" != "1" ]
112: then
113: if [ ! -r $fstype_file ]
114: then
115: /bin/mount $device $mount_point 2> /dev/null
116: else
117: Result1="`echo $fs | /bin/awk 'END {print NR}'`"
118: if [ "$Result1" != "1" ]
119: then
120: /bin/mount $device $mount_point 2> /dev/null
121: else
122: /bin/mount -t $fs $device $mount_point 2> /dev/null
123: fi
124: fi
125: if [ $? != 0 ]
126: then
127: retry_count=3
128: sleep_time=1
129: result_flag=1
130:
131: while [ $retry_count -gt 0 ]
132: do
133: if [ ! -r $fstype_file ]
134: then
135: /bin/mount $device $mount_point > $err_log_path/$dev.mount 2>&1
136: else
137: Result1="`echo $fs | /bin/awk 'END {print NR}'`"
138: if [ "$Result1" != "1" ]
139: then
140: /bin/mount $device $mount_point > $err_log_path/$dev.mount 2>&1
141: else
142: /bin/mount -t $fs $device $mount_point > $err_log_path/$dev.mount 2>&1
143: fi
144: fi
145: if [ $? != 0 ]
146: then
147: retry_count=`expr $retry_count - 1`
148: /bin/sleep $sleep_time
149: else
150: /bin/rm -f $err_log_path/$dev.mount
151: result_flag=0
152: break
153: fi
154: done
155:
156: if [ $result_flag != 0 ]
157: then
158: exit 11
159: fi
160: fi
161: fi
162: /bin/rm -rf $post_file 2> /dev/null
163: /bin/rm -rf $fstype_file 2> /dev/null
164: exit 0
165: fi
166:
167: exit 0 |
RepDst.post(複写先ボリューム後処理のシェルスクリプト)
1: #!/bin/sh
2:
3: # AdvancedCopy Manager
4: # All Rights Reserved, Copyright FUJITSU LIMITED, 2002-2008
5:
6: #
7: # Post-processing of Replication(Destination) processing
8: #
9: # Argument: $1 Device name of Destination disk
10: #
11: # Error number
12: # 2: Argument error
13: # 11 mount error
14:
15: # Argument check
16: case $# in
17: 1)
18: ;;
19: *)
20: exit 2
21: ;;
22: esac
23:
24: device=$1
25:
26: # Determination of postprocessing file name
27: if [ "`echo $device | /bin/grep "/dev/sd"`" != "" ]
28: then
29: # /dev/sd? -> sd?
30: dev="`echo $device | /bin/sed "s/\/dev\///"`"
31: elif [ "`echo $device | /bin/grep "/dev/FJSV"`" != "" ]
32: then
33: # /dev/FJSVmphd/dsk/mplb?s? -> mplb?s?
34: # /dev/FJSVmphd/dsk/mphd?s? -> mphd?s?
35: dev="`echo $device | /bin/cut -d/ -f5`"
36: elif [ "`echo $device | /bin/grep "/dev/sfdsk/"`" != "" ]
37: then
38: if [ "`echo $device | /bin/grep ":"`" != "" ]
39: then
40: devnam="`echo $device | /bin/cut -d: -f2-`"
41: # /dev/sfdsk/class/dsk/volume:sd? -> class_volume_sd?
42: dev="`echo $device | /bin/sed "s/\/dev\/sfdsk\///"`"
43: dev="`echo $dev | /bin/sed "s/\/dsk\//_/"`"
44: dev="`echo $dev | /bin/sed "s/:/_/"`"
45: device="`echo $device | /bin/cut -d: -f1`"
46: if [ "`echo $devnam | /bin/grep "/dev/disk/by-id/"`" != "" ]
47: then
48: # /dev/sfdsk/class/dsk/volume:/dev/disk/by-id/<device> -> class_volume__by_id_<device>
49: dev="`echo $dev | /bin/sed "s/\/dev\/disk\/by-id\//_by-id_/"`"
50: elif [ "`echo $devnam | /bin/grep "/dev/disk/by-path/"`" != "" ]
51: then
52: # /dev/sfdsk/class/dsk/volume:/dev/disk/by-path/<device> -> class_volume__by_path_<device>
53: dev="`echo $dev | /bin/sed "s/\/dev\/disk\/by-path\//_by-path_/"`"
54: fi
55: else
56: # /dev/sfdsk/class/dsk/volume -> _gds_class_volume
57: dev="_gds_`echo $device | /bin/sed "s/\/dev\/sfdsk\///"`"
58: dev="`echo $dev | /bin/sed "s/\/dsk\//_/"`"
59: fi
60: elif [ "`echo $device | /bin/grep "/dev/disk/by-id/"`" != "" ]
61: then
62: # "/dev/disk/by-id/<device>" -> "_by-id_<device>"
63: dev="_by-id_`echo $device | /bin/sed "s/\/dev\/disk\/by-id\///"`"
64: elif [ "`echo $device | /bin/grep "/dev/disk/by-path/"`" != "" ]
65: then
66: # "/dev/disk/by-path/<device>" -> "_by-path_<device>"
67: dev="_by-path_`echo $device | /bin/sed "s/\/dev\/disk\/by-path\///"`"
68: else
69: exit 0
70: fi
71: post_file="/etc/opt/FJSVswsrp/"$SWSTGNODE"/data/DEFAULT/"$dev".dpre"
72: fstype_file="/etc/opt/FJSVswsrp/"$SWSTGNODE"/data/DEFAULT/"$dev".dfstype"
73:
74: err_log_path="/var/opt/FJSVswsrp/"$SWSTGNODE"/log"
75:
76: # Confirmation of postprocessing
77: if [ ! -r $post_file ]
78: then
79: exit 0
80: fi
81: post="`/bin/cat $post_file | /bin/cut -d',' -f1`"
82: mount_point="`/bin/cat $post_file | /bin/cut -d',' -f2`"
83:
84: # Confirmation of FStype
85: if [ ! -r $fstype_file ]
86: then
87: fs=""
88: else
89: fs="`/bin/cat $fstype_file`"
90: fi
91:
92: # No processing
93: if [ "$post" = "none" ]
94: then
95: /bin/rm -rf $post_file 2> /dev/null
96: /bin/rm -rf $fstype_file 2> /dev/null
97: exit 0
98: fi
99:
100: # mount processing
101: if [ "$post" = "mount" ]
102: then
103: # df -l $device > /dev/null 2>&1
104: # if [ $? != 0 ]
105: if [ "`echo $device | /bin/grep "/dev/disk/by-id/"`" != "" \
106: -o "`echo $device | /bin/grep "/dev/disk/by-path/"`" != "" ]
107: then
108: cdevice="/dev/`/usr/bin/readlink $device | /bin/sed "s/..\/..\///"`"
109: Result="`/bin/df -l | /bin/grep "$cdevice " | /bin/awk 'END {print NR}'`"
110: else
111: Result="`/bin/df -l | /bin/grep "$device " | /bin/awk 'END {print NR}'`"
112: fi
113: if [ "$Result" != "1" ]
114: then
115: if [ ! -r $fstype_file ]
116: then
117: /bin/mount $device $mount_point 2> /dev/null
118: else
119: Result1="`echo $fs | /bin/awk 'END {print NR}'`"
120: if [ "$Result1" != "1" ]
121: then
122: /bin/mount $device $mount_point 2> /dev/null
123: else
124: /bin/mount -t $fs $device $mount_point 2> /dev/null
125: fi
126: fi
127: if [ $? != 0 ]
128: then
129: retry_count=3
130: sleep_time=1
131: result_flag=1
132:
133: while [ $retry_count -gt 0 ]
134: do
135: if [ ! -r $fstype_file ]
136: then
137: /bin/mount $device $mount_point > $err_log_path/$dev.mount 2>&1
138: else
139: Result1="`echo $fs | /bin/awk 'END {print NR}'`"
140: if [ "$Result1" != "1" ]
141: then
142: /bin/mount $device $mount_point > $err_log_path/$dev.mount 2>&1
143: else
144: /bin/mount -t $fs $device $mount_point > $err_log_path/$dev.mount 2>&1
145: fi
146: fi
147: if [ $? != 0 ]
148: then
149: retry_count=`expr $retry_count - 1`
150: /bin/sleep $sleep_time
151: else
152: /bin/rm -f $err_log_path/$dev.mount
153: result_flag=0
154: break
155: fi
156: done
157:
158: if [ $result_flag != 0 ]
159: then
160: exit 11
161: fi
162: fi
163: fi
164: /bin/rm -rf $post_file 2> /dev/null
165: /bin/rm -rf $fstype_file 2> /dev/null
166: exit 0
167: fi
168:
169: exit 0 |