4 # The contents of this file are subject to the terms of the
5 # Common Development and Distribution License (the "License").
6 # You may not use this file except in compliance with the License.
8 # You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9 # or http://www.opensolaris.org/os/licensing.
10 # See the License for the specific language governing permissions
11 # and limitations under the License.
13 # When distributing Covered Code, include this CDDL HEADER in each
14 # file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15 # If applicable, add the following below this CDDL HEADER, with the
16 # fields enclosed by brackets "[]" replaced with your own identifying
17 # information: Portions Copyright [yyyy] [name of copyright owner]
22 # Copyright 2008 Sun Microsystems, Inc. All rights reserved.
23 # Use is subject to license terms.
27 # Description: This is the SNDR start script. It must be located
28 # in /etc/init.d with links to the appropriate rc2.d and
30 # It can also be used to start or stop a specified cluster
31 # resource group when invoked from the data service cluster
37 RDCBOOT
="/usr/sbin/sndrboot"
38 USAGE
="Usage: $0 {start|stop} [cluster_resource]"
40 DSCFG_DEPEND_NOCHK
="/tmp/.dscfgadm_pid"
41 OS_MINOR
=`/usr/bin/uname -r | /usr/bin/cut -d '.' -f2`
43 .
/lib
/svc
/share
/smf_include.sh
45 # Make sure prior SMF dependents are not 'online'
46 # $1 = name of SMF service to validate dependents
53 if [ $OS_MINOR -ge 11 ]
56 elif [ -f $DSCFG_DEPEND_NOCHK ]
58 for pid
in `pgrep dscfgadm`
60 if [ `grep -c $pid $DSCFG_DEPEND_NOCHK` -gt 0 ]
65 elif [ `ps -ef | grep preremove | grep -c SUNWrdcu` -gt 0 ]
71 while [ $count -ne 0 ]
73 count
=`$SVCS -o STATE -D $1 2>>/dev/null | grep "^online" | wc -l`
76 # Output banner after waiting first 5 seconds
80 echo "Waiting for $1 dependents to be 'offline'"
81 $SVCS -D $1 2>>/dev
/null |
grep "^online"
84 # Has it been longer then 5 minutes? (60 * 5 secs.)
88 echo "Error: Failed waiting for $1 dependents to be 'offline'"
89 $SVCS -D $1 2>>/dev
/null |
grep "^online"
90 exit $SMF_EXIT_ERR_FATAL
93 # Now sleep, giving other services time to stop
96 times=`expr $times + 1`
102 CLINFO
=/usr
/sbin
/clinfo
104 killproc
() { # kill the named process(es)
105 pid
=`/usr/bin/ps -e |
106 /usr/bin/grep -w $1 |
107 /usr/bin/sed -e 's/^ *//' -e 's/ .*//'`
108 [ "$pid" != "" ] && kill $pid
124 # SNDR 3.2 SetIDs fixup
125 ${RDCBOOT} -C post-patch-setids
-r -s
128 ${RDCBOOT} ${COPT} -r
131 # non-clustered start
142 RDCBOOT
=/usr
/bin
/true
145 do_smf_depends
"system/nws_rdc"
156 ${RDCBOOT} ${COPT} -s
158 echo "killing SNDR daemons"
167 echo "killing SNDR daemons"
172 # no sndr boot command, kill daemon anyway
174 echo "killing SNDR daemons"