3 # Copyright 2001,2003 Sun Microsystems, Inc. All rights reserved.
4 # Use is subject to license terms.
6 # This file is part of Quagga.
8 # Quagga is free software; you can redistribute it and/or modify it
9 # under the terms of the GNU General Public License as published by the
10 # Free Software Foundation; either version 2, or (at your option) any
13 # Quagga is distributed in the hope that it will be useful, but
14 # WITHOUT ANY WARRANTY; without even the implied warranty of
15 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 # General Public License for more details.
18 # You should have received a copy of the GNU General Public License
19 # along with Quagga; see the file COPYING. If not, write to the Free
20 # Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
25 # Starts/stops the given daemon
27 SMFINCLUDE
=/lib
/svc
/share
/smf_include.sh
30 quagga_is_globalzone
() {
31 if [ "${QUAGGA_INIT_ZONENAME:=`/sbin/zonename`}" != "global" ]; then
38 # Include smf functions, if available. If not, define smf_present to indicate
39 # there is no SMF. Should allow this script to work pre-S10.
40 if [ -f "$SMFINCLUDE" ] ; then
43 # pre-SMF system, fake up any functions and exit codes
44 # which SMFINCLUDE usually provides.
49 SMF_EXIT_ERR_CONFIG
=96;
50 SMF_EXIT_ERR_FATAL
=95;
53 # if there's no SMF, set some default DAEMON_ARGS
54 smf_present || DAEMON_ARGS
=""
58 echo "Usage: $0 <daemon> <daemon arguments>";
60 echo "Usage: $0 <stop|start> <daemon> <daemon arguments>";
62 echo "The --pid_file argument is implied";
63 echo "This help message: $0 <help|usage>";
66 # parse arguments, different according to SMF or not.
85 # daemon path must be given
86 if [ -z "$DAEMON_PATH/$DAEMON" ]; then
88 exit $SMF_EXIT_ERR_FATAL
91 # only bgpd is suitable for running in a non-global zone, at this
95 quagga_is_globalzone ||
exit $SMF_EXIT_OK
99 ospfd | ospf6d | ripd | ripngd
)
100 quagga_is_globalzone ||
exit $SMF_EXIT_OK
104 exit $SMF_EXIT_ERR_CONFIG;
108 # we need @quagga_statedir@ to exist, it probably is on tmpfs.
109 if [ ! -d @quagga_statedir@
] ; then
110 mkdir
-p @quagga_statedir@
111 chown @enable_user@
:@enable_group@ @quagga_statedir@
112 chmod 751 @quagga_statedir@
115 PIDFILE
="@quagga_statedir@/${DAEMON}.pid"
118 $DAEMON_PATH/$DAEMON $DAEMON_ARGS --pid_file ${PIDFILE} &
122 if [ -f "${PIDFILE}" ]; then
123 /usr
/bin
/kill -TERM `/usr/bin/cat "${PIDFILE}"`
127 case "$QUAGGA_METHOD" in
137 exit SMF_EXIT_ERR_FATAL