バックアップ実行時の前処理のシェルスクリプト名は、以下のとおりです。
クラスタ運用でない場合
/etc/opt/FJSVswsts/sh/OpcBackup.pre
クラスタ運用の場合
/etc/opt/FJSVswsts/logicalNodeName/sh/OpcBackup.preシェルスクリプトの内容は、以下のとおりです。
1: #!/bin/sh
2:
3: # AdvancedCopy Manager
4: # All Rights Reserved, Copyright FUJITSU LIMITED, 2002-2021
5:
6: #
7: # Pre-processing of backup processing
8: #
9: # Argument: $1 Device name of transaction disk
10: # $2 Mount point of transaction disk
11: # $3 Device name of backup disk
12: #
13: # Error number
14: # 2: Argument error
15: # 10: umount error
16:
17:
18: # Argument check
19: case $# in
20: 1)
21: ;;
22: 2)
23: ;;
24: 3)
25: ;;
26: *)
27: exit 2
28: ;;
29: esac
30:
31: device="`echo $1`"
32: mount_point="`echo $2`"
33: bk_device="`echo $3`"
34: cyclemax=3
35: unmount_cyclenumfile="unmount.cyclenum"
36:
37: # Determination postprocessing file name
38:
39: if [ "$SWSTGNODE" != "" ]
40: then
41: swstg_node="/`echo $SWSTGNODE`"
42: else
43: swstg_node=""
44: fi
45:
46: err_log_path="/var/opt/FJSVswsts"$swstg_node"/log"
47:
48: if [ "`echo $device | /usr/bin/grep "/dev/dsk/"`" != "" ]
49: then
50: # /dev/dsk/c?t?d?s? -> c?t?d?s?
51: dev="`echo $device | /usr/bin/sed "s/\/dev\/dsk\///"`"
52: elif [ "`echo $device | /usr/bin/grep "/dev/FJSV"`" != "" ]
53: then
54: # /dev/FJSVmphd/dsk/mplb?s? -> /dev/FJSVmphd/dsk/mplb?s?
55: # /dev/FJSVmphd/dsk/mphd?s? -> /dev/FJSVmphd/dsk/mphd?s?
56: dev="`echo $device | /usr/bin/cut -d/ -f5`"
57: elif [ "`echo $device | /usr/bin/grep "/dev/sfdsk/"`" != "" ]
58: then
59: if [ "`echo $device | /usr/bin/grep ":"`" != "" ]
60: then
61: # /dev/sfdsk/class/dsk/volume:c?t?d? -> class_volume_c?t?d?
62: dev="`echo $device | /usr/bin/sed "s/\/dev\/sfdsk\///"`"
63: dev="`echo $dev | /usr/bin/sed "s/\/dsk\//_/"`"
64: dev="`echo $dev | /usr/bin/sed "s/:/_/"`"
65: device="`echo $device | /usr/bin/cut -d: -f1`"
66: else
67: # /dev/sfdsk/class/dsk/volume -> _gds_class_volume
68: dev="_gds_`echo $device | /usr/bin/sed "s/\/dev\/sfdsk\///"`"
69: dev="`echo $dev | /usr/bin/sed "s/\/dsk\//_/"`"
70: fi
71: elif [ "`echo $device | /usr/bin/grep "/dev/vx/dsk/"`" != "" ]
72: then
73: # /dev/vx/dsk/volume -> _vx_rootdg_volume
74: # /dev/vx/dsk/disk-group/volume -> _vx_disk-group_volume
75: dev=_vx_"`echo $device | /usr/bin/awk -F\/ '{ if (NF == 6) { print $5"_"$6 } else print "rootdg_"$5 }'`"
76: elif [ "`echo $device | /usr/bin/grep "/dev/vx/dmp/"`" != "" ]
77: then
78: # /dev/vx/dmp/device -> _vx_pv_device
79: dev=_vx_pv_"`echo $device | /usr/bin/cut -d/ -f5`"
80: else
81: exit 0
82: fi
83: post_file="/etc/opt/FJSVswsts"$swstg_node"/data/DEFAULT/"$dev".pre"
84: fstype_file="/etc/opt/FJSVswsts"$swstg_node"/data/DEFAULT/"$dev".fstype"
85: bd_file="/etc/opt/FJSVswsts"$swstg_node"/data/DEFAULT/"$dev".bd"
86:
87: if [ "$mount_point" != "" ]
88: then
89:
90: # When device cannot be unmounted
91: #
92: # if [ "$device" = "/dev/dsk/cXtXdXsX" -o "$device" = "/dev/dsk/cYtYdYsY" ]
93: # then
94: # /usr/sbin/lockfs -w $mount_point > /dev/null 2>&1
95: # if [ "$bk_device" != "" ]
96: # then
97: # echo $bk_device > $bd_file
98: # fi
99: # df -ln $mount_point | cut -f2 -d: | cut -f2 -d' ' > $fstype_file
100: # echo "fsck" > $post_file
101: #
102: # When device can be unmounted
103: #
104: # else
105: /usr/bin/df -ln $mount_point | /usr/bin/cut -f2 -d: | /usr/bin/cut -f2 -d' ' > $fstype_file
106: /usr/sbin/umount $mount_point 2>/dev/null
107: if [ $? != 0 ]
108: then
109: retry_count=3
110: retry_def=$retry_count
111: sleep_time=1
112: result_flag=1
113:
114: while [ $retry_count -gt 0 ]
115: do
116: /usr/sbin/umount $mount_point > $err_log_path/$dev.umount 2>&1
117: if [ $? != 0 ]
118: then
119: if [ $retry_count -eq $retry_def ]
120: then
121: if [ -f $err_log_path/$unmount_cyclenumfile ]
122: then
123: cyclenum=`/usr/bin/cut -c 1 $err_log_path/$unmount_cyclenumfile`
124: cyclenum=`expr $cyclenum + 1 2>/dev/null`
125: if [ $? != 0 ]; then
126: cyclenum='1'
127: fi
128: if [ $cyclenum -gt $cyclemax ]; then
129: cyclenum='1'
130: fi
131: else
132: cyclenum='1'
133: fi
134: echo $cyclenum > $err_log_path/$unmount_cyclenumfile
135: : > $err_log_path/"$dev"_$cyclenum.umount
136: : > $err_log_path/"$dev"_$cyclenum.fuser
137: : > $err_log_path/"$dev"_$cyclenum.ps
138: fi
139:
140: echo `date '+%Y-%m-%d %T'` >> $err_log_path/"$dev"_$cyclenum.umount
141: echo `date '+%Y-%m-%d %T'` >> $err_log_path/"$dev"_$cyclenum.fuser
142: echo `date '+%Y-%m-%d %T'` >> $err_log_path/"$dev"_$cyclenum.ps
143: /usr/bin/cat $err_log_path/$dev.umount >> $err_log_path/"$dev"_$cyclenum.umount 2>&1
144: /usr/sbin/fuser -cu $mount_point >> $err_log_path/"$dev"_$cyclenum.fuser 2>&1
145: /usr/bin/ps -ef >> $err_log_path/"$dev"_$cyclenum.ps 2>&1
146: echo "" >> $err_log_path/"$dev"_$cyclenum.umount
147: echo "" >> $err_log_path/"$dev"_$cyclenum.fuser
148: echo "" >> $err_log_path/"$dev"_$cyclenum.ps
149:
150: retry_count=`expr $retry_count - 1`
151: /usr/bin/sleep $sleep_time
152: else
153: /usr/bin/rm -f $err_log_path/$dev.umount
154: result_flag=0
155: break
156: fi
157: done
158:
159: if [ $result_flag != 0 ]
160: then
161: exit 10
162: fi
163: fi
164: echo "mount" > $post_file
165:
166: # fi
167:
168: # When device was not mounted
169: #
170: else
171: echo "none" > $post_file
172: fi
173:
174: exit 0