1: #!/bin/sh
2:
3: # AdvancedCopy Manager
4: # All Rights Reserved, Copyright FUJITSU LIMITED, 2002-2007
5:
6: #
7: # Preprocessing 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:
35: # Determination postprocessing file name
36:
37: if [ "$SWSTGNODE" != "" ]
38: then
39: swstg_node="/`echo $SWSTGNODE`"
40: else
41: swstg_node=""
42: fi
43:
44: err_log_path="/var/opt/FJSVswsts"$swstg_node"/log"
45:
46: if [ "`echo $device | /usr/bin/grep "/dev/dsk/"`" != "" ]
47: then
48: # /dev/dsk/c?t?d?s? -> c?t?d?s?
49: dev="`echo $device | /usr/bin/sed "s/\/dev\/dsk\///"`"
50: elif [ "`echo $device | /usr/bin/grep "/dev/FJSV"`" != "" ]
51: then
52: # /dev/FJSVmphd/dsk/mplb?s? -> /dev/FJSVmphd/dsk/mplb?s?
53: # /dev/FJSVmphd/dsk/mphd?s? -> /dev/FJSVmphd/dsk/mphd?s?
54: dev="`echo $device | /usr/bin/cut -d/ -f5`"
55: elif [ "`echo $device | /usr/bin/grep "/dev/sfdsk/"`" != "" ]
56: then
57: if [ "`echo $device | /usr/bin/grep ":"`" != "" ]
58: then
59: # /dev/sfdsk/class/dsk/volume:c?t?d? -> class_volume_c?t?d?
60: dev="`echo $device | /usr/bin/sed "s/\/dev\/sfdsk\///"`"
61: dev="`echo $dev | /usr/bin/sed "s/\/dsk\//_/"`"
62: dev="`echo $dev | /usr/bin/sed "s/:/_/"`"
63: device="`echo $device | /usr/bin/cut -d: -f1`"
64: else
65: # /dev/sfdsk/class/dsk/volume -> _gds_class_volume
66: dev="_gds_`echo $device | /usr/bin/sed "s/\/dev\/sfdsk\///"`"
67: dev="`echo $dev | /usr/bin/sed "s/\/dsk\//_/"`"
68: fi
69: elif [ "`echo $device | /usr/bin/grep "/dev/vx/dsk/"`" != "" ]
70: then
71: # /dev/vx/dsk/volume -> _vx_rootdg_volume
72: # /dev/vx/dsk/disk-group/volume -> _vx_disk-group_volume
73: dev=_vx_"`echo $device | /usr/bin/awk -F\/ '{ if (NF == 6) { print $5"_"$6 } else print "rootdg_"$5 }'`"
74: elif [ "`echo $device | /usr/bin/grep "/dev/vx/dmp/"`" != "" ]
75: then
76: # /dev/vx/dmp/device -> _vx_pv_device
77: dev=_vx_pv_"`echo $device | /usr/bin/cut -d/ -f5`"
78: else
79: exit 0
80: fi
81: post_file="/etc/opt/FJSVswsts"$swstg_node"/data/DEFAULT/"$dev".pre"
82: fstype_file="/etc/opt/FJSVswsts"$swstg_node"/data/DEFAULT/"$dev".fstype"
83: bd_file="/etc/opt/FJSVswsts"$swstg_node"/data/DEFAULT/"$dev".bd"
84:
85: if [ "$mount_point" != "" ]
86: then
87:
88: # When device cannot be unmounted
89: #
90: #if [ "$device" = "/dev/dsk/cXtXdXsX" -o "$device" = "/dev/dsk/cYtYdYsY" ]
91: #then
92: #/usr/sbin/lockfs -w $mount_point > /dev/null 2>&1
93: #if [ "$bk_device" != "" ]
94: #then
95: #echo $bk_device > $bd_file
96: #fi
97: #df -ln $mount_point | cut -f2 -d: | cut -f2 -d' ' > $fstype_file
98: #sync
99: #sync
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: sleep_time=1
111: result_flag=1
112:
113: while [ $retry_count -gt 0 ]
114: do
115: /usr/sbin/umount $mount_point > $err_log_path/$dev.umount 2>&1
116: if [ $? != 0 ]
117: then
118: retry_count=`expr $retry_count - 1`
119: /usr/bin/sleep $sleep_time
120: else
121: /usr/bin/rm -f $err_log_path/$dev.umount
122: result_flag=0
123: break
124: fi
125: done
126:
127: if [ $result_flag != 0 ]
128: then
129: /usr/sbin/fuser -cu $mount_point> $err_log_path/$dev.fuser 2>&1
130: /usr/bin/ps -ef > $err_log_path/$dev.ps 2>&1
131:
132: exit 10
133: fi
134: fi
135: echo "mount" > $post_file
136:
137: #fi
138:
139: # When device was not mounted
140: #
141: else
142: echo "none" > $post_file
143: fi
144:
145: exit 0 |