1: #!/bin/sh
2:
3: # AdvancedCopy Manager
4: # All Rights Reserved, Copyright FUJITSU LIMITED, 2002-2006
5:
6: #
7: # Preprocessing of restoration processing
8: #
9: # Argument: $1 Device name of transaction disk
10: # $2 Mount point of transaction disk
11: #
12: # Error number
13: # 2: Argument error
14: # 10: umount error
15:
16:
17: # Argument check
18: case $# in
19: 1)
20: ;;
21: 2)
22: ;;
23: *)
24: exit 2
25: ;;
26: esac
27:
28: device="`echo $1`"
29: mount_point="`echo $2`"
30:
31: # Determination of postprocessing file name
32:
33: if [ "$SWSTGNODE" != "" ]
34: then
35: swstg_node="/`echo $SWSTGNODE`"
36: else
37: swstg_node=""
38: fi
39:
40: err_log_path="/var/opt/FJSVswsts"$swstg_node"/log"
41:
42: if [ "`echo $device | /usr/bin/grep "/dev/dsk/"`" != "" ]
43: then
44: # /dev/dsk/c?t?d?s? -> c?t?d?s?
45: dev="`echo $device | /usr/bin/sed "s/\/dev\/dsk\///"`"
46: elif [ "`echo $device | /usr/bin/grep "/dev/FJSV"`" != "" ]
47: then
48: # /dev/FJSVmphd/dsk/mplb?s? -> /dev/FJSVmphd/dsk/mplb?s?
49: # /dev/FJSVmphd/dsk/mphd?s? -> /dev/FJSVmphd/dsk/mphd?s?
50: dev="`echo $device | /usr/bin/cut -d/ -f5`"
51: elif [ "`echo $device | /usr/bin/grep "/dev/sfdsk/"`" != "" ]
52: then
53: if [ "`echo $device | /usr/bin/grep ":"`" != "" ]
54: then
55: # /dev/sfdsk/class/dsk/volume:c?t?d? -> class_volume_c?t?d?
56: dev="`echo $device | /usr/bin/sed "s/\/dev\/sfdsk\///"`"
57: dev="`echo $dev | /usr/bin/sed "s/\/dsk\//_/"`"
58: dev="`echo $dev | /usr/bin/sed "s/:/_/"`"
59: device="`echo $device | /usr/bin/cut -d: -f1`"
60: else
61: # /dev/sfdsk/class/dsk/volume -> _gds_class_volume
62: dev="_gds_`echo $device | /usr/bin/sed "s/\/dev\/sfdsk\///"`"
63: dev="`echo $dev | /usr/bin/sed "s/\/dsk\//_/"`"
64: fi
65: elif [ "`echo $device | /usr/bin/grep "/dev/vx/dsk/"`" != "" ]
66: then
67: # /dev/vx/dsk/volume -> _vx_rootdg_volume
68: # /dev/vx/dsk/disk-group/volume -> _vx_disk-group_volume
69: dev=_vx_"`echo $device | /usr/bin/awk -F\/ '{ if (NF == 6) { print $5"_"$6 } else print "rootdg_"$5 }'`"
70: elif [ "`echo $device | /usr/bin/grep "/dev/vx/dmp/"`" != "" ]
71: then
72: # /dev/vx/dmp/device -> _vx_pv_device
73: dev=_vx_pv_"`echo $device | /usr/bin/cut -d/ -f5`"
74: else
75: exit 0
76: fi
77: post_file="/etc/opt/FJSVswsts"$swstg_node"/data/DEFAULT/"$dev".pre"
78: fstype_file="/etc/opt/FJSVswsts"$swstg_node"/data/DEFAULT/"$dev".fstype"
79: bd_file="/etc/opt/FJSVswsts"$swstg_node"/data/DEFAULT/"$dev".bd"
80:
81: if [ "$mount_point" != "" ]
82: then
83:
84: # When device can be unmounted
85: #
86: /usr/bin/df -ln $mount_point | /usr/bin/cut -f2 -d: | /usr/bin/cut -f2 -d' ' > $fstype_file
87: /usr/sbin/umount $mount_point 2> /dev/null
88: if [ $? != 0 ]
89: then
90: retry_count=3
91: sleep_time=1
92: result_flag=1
93:
94: while [ $retry_count -gt 0 ]
95: do
96: /usr/sbin/umount $mount_point > $err_log_path/$dev.umount 2>&1
97: if [ $? != 0 ]
98: then
99: retry_count=`expr $retry_count - 1`
100: /usr/bin/sleep $sleep_time
101: else
102: /usr/bin/rm -f $err_log_path/$dev.umount
103: result_flag=0
104: break
105: fi
106: done
107:
108: if [ $result_flag != 0 ]
109: then
110: /usr/sbin/fuser -cu $mount_point> $err_log_path/$dev.fuser 2>&1
111: /usr/bin/ps -ef > $err_log_path/$dev.ps 2>&1
112:
113: exit 10
114: fi
115: fi
116: echo "mount" > $post_file
117:
118: # When device was not mounted
119: #
120: else
121: echo "none" > $post_file
122: fi
123:
124: exit 0 |