blob: 198d1186b2c053b6bf328e1938328453ca2b11a3 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
|
#!/bin/sh
# CDDL HEADER START
#
# The contents of this file are subject to the terms of the
# Common Development and Distribution License (the "License").
# You may not use this file except in compliance with the License.
#
# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
# or http://www.opensolaris.org/os/licensing.
# See the License for the specific language governing permissions
# and limitations under the License.
#
# When distributing Covered Code, include this CDDL HEADER in each
# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
# If applicable, add the following below this CDDL HEADER, with the
# fields enclosed by brackets "[]" replaced with your own identifying
# information: Portions Copyright [yyyy] [name of copyright owner]
#
# CDDL HEADER END
#
#
# Copyright 2008 Sun Microsystems, Inc. All rights reserved.
# Use is subject to license terms.
#
# SNDR start script
#
# Description: This is the SNDR start script. It must be located
# in /etc/init.d with links to the appropriate rc2.d and
# rc0.d files.
# It can also be used to start or stop a specified cluster
# resource group when invoked from the data service cluster
# failover script.
#
#
#
PATH=/etc:/bin
RDCBOOT="/usr/sbin/sndrboot"
USAGE="Usage: $0 {start|stop} [cluster_resource]"
SVCS=/usr/bin/svcs
DSCFG_DEPEND_NOCHK="/tmp/.dscfgadm_pid"
OS_MINOR=`/usr/bin/uname -r | /usr/bin/cut -d '.' -f2`
. /lib/svc/share/smf_include.sh
# Make sure prior SMF dependents are not 'online'
# $1 = name of SMF service to validate dependents
#
do_smf_depends ()
{
times=0
count=1
if [ $OS_MINOR -ge 11 ]
then
return 0
elif [ -f $DSCFG_DEPEND_NOCHK ]
then
for pid in `pgrep dscfgadm`
do
if [ `grep -c $pid $DSCFG_DEPEND_NOCHK` -gt 0 ]
then
return 0
fi
done
elif [ `ps -ef | grep preremove | grep -c SUNWrdcu` -gt 0 ]
then
return 0
fi
while [ $count -ne 0 ]
do
count=`$SVCS -o STATE -D $1 2>>/dev/null | grep "^online" | wc -l`
if [ $count -ne 0 ]
then
# Output banner after waiting first 5 seconds
#
if [ $times -eq 1 ]
then
echo "Waiting for $1 dependents to be 'offline'"
$SVCS -D $1 2>>/dev/null | grep "^online"
fi
# Has it been longer then 5 minutes? (60 * 5 secs.)
#
if [ $times -eq 60 ]
then
echo "Error: Failed waiting for $1 dependents to be 'offline'"
$SVCS -D $1 2>>/dev/null | grep "^online"
exit $SMF_EXIT_ERR_FATAL
fi
# Now sleep, giving other services time to stop
#
sleep 5
times=`expr $times + 1`
fi
done
return 0
}
CLINFO=/usr/sbin/clinfo
killproc() { # kill the named process(es)
pid=`/usr/bin/ps -e |
/usr/bin/grep -w $1 |
/usr/bin/sed -e 's/^ *//' -e 's/ .*//'`
[ "$pid" != "" ] && kill $pid
}
case "$1" in
'start')
COPT=
if [ -x ${RDCBOOT} ]
then
if ${CLINFO}
then
if [ "$2" != "" ]
then
${RDCBOOT} -r -C $2
else
# SNDR 3.2 SetIDs fixup
${RDCBOOT} -C post-patch-setids -r -s
COPT="-C -"
${RDCBOOT} ${COPT} -r
fi
else
# non-clustered start
${RDCBOOT} -r
fi
fi
;;
'stop')
COPT=
if [ ! -r /dev/rdc ]
then
RDCBOOT=/usr/bin/true
fi
do_smf_depends "system/nws_rdc"
if [ -x ${RDCBOOT} ]
then
if ${CLINFO}
then
if [ "$2" != "" ]
then
${RDCBOOT} -s -C $2
else
COPT="-C -"
${RDCBOOT} ${COPT} -s
echo "killing SNDR daemons"
killproc sndrd
killproc sndrsync
fi
else
# non-clustered stop
${RDCBOOT} -s
echo "killing SNDR daemons"
killproc sndrd
killproc sndrsync
fi
else
# no sndr boot command, kill daemon anyway
echo "killing SNDR daemons"
killproc sndrd
killproc sndrsync
fi
;;
*)
echo $USAGE
exit 1
;;
esac
exit $SMF_EXIT_OK
|