summaryrefslogtreecommitdiff
path: root/solaris/quagga.init.in
diff options
context:
space:
mode:
authorpaul <paul>2005-06-15 11:00:11 +0000
committerpaul <paul>2005-06-15 11:00:11 +0000
commit9b78d0528ad6756b051d82faddfa2c3422403a2e (patch)
tree566594eea017950238265f3636860e3aaf2f68e5 /solaris/quagga.init.in
parent62debbbe836d4c96402756ccfead01b09d903428 (diff)
2005-06-15 Paul Jakma <paul.jakma@sun.com>
* quagga.xml.in: Pass the FMRI to the method, removing need for daemon_name property and deducing the FMRI. remove the empty config_file and pid_file definitions, they just make things difficult in the method script, cause it then has to deal with svcprop returning "" for defined empty properties. Remove daemon_name everywhere. * quagga.init.in: Take the FMRI as an argument Remove deducing the FMRI from the defunct daemon_name property. Use svcprop -q to test for presence of a property first. Default vty_port to 0 and vty_addr to 127.1 if equivalent SMF properties are not set. Deduce the pid_file, we can infer it from @quagga_statedir@ I think, it's probably not useful to allow it to be configurable as a property anyway. /var/run/ is on tmpfs on Solaris, so we probably will need to create @quagga_statedir@ first run after boot. Use @sbindir@, not /usr/local/sbin.
Diffstat (limited to 'solaris/quagga.init.in')
-rwxr-xr-xsolaris/quagga.init.in62
1 files changed, 42 insertions, 20 deletions
diff --git a/solaris/quagga.init.in b/solaris/quagga.init.in
index 1d3a5cd3..ba3b484a 100755
--- a/solaris/quagga.init.in
+++ b/solaris/quagga.init.in
@@ -3,7 +3,7 @@
# Copyright 2001,2003 Sun Microsystems, Inc. All rights reserved.
# Use is subject to license terms.
#
-# $Id: quagga.init.in,v 1.3 2005/06/02 16:33:53 paul Exp $
+# $Id: quagga.init.in,v 1.4 2005/06/15 11:00:11 paul Exp $
#
# Starts/stops the appropriate daemon
@@ -14,7 +14,7 @@ if [ -f "$SMFINCLUDE" ] ; then
fi
usage () {
- echo "Usage: $0 (start|stop) <fmri>";
+ echo "Usage: $0 (start|stop) <fmri> <instance>";
}
case $1 in
@@ -23,9 +23,10 @@ case $1 in
;;
esac
-# fmri must be given.
+# fmri and instance must be given.
FMRI="$2"
-if [ -z "$FMRI" ]; then
+INSTANCE="$3"
+if [ -z "$FMRI" -o -z "$INSTANCE" ]; then
usage
exit $SMF_EXIT_ERR_CONFIG
fi
@@ -33,10 +34,7 @@ fi
# fmri must exist
svcs ${FMRI} > /dev/null 2>&1 || exit $SMF_EXIT_ERR_CONFIG
-DAEMON=`svcprop -p @PACKAGE_TARNAME@/daemon_name ${FMRI} 2> /dev/null`
-[ -z "${DAEMON}" ] && exit $SMF_EXIT_ERR_CONFIG
-
-case ${DAEMON} in
+case ${INSTANCE} in
zebra | ospfd | ospf6d | ripd | ripngd | bgpd )
;;
*)
@@ -45,28 +43,52 @@ case ${DAEMON} in
;;
esac
-CONFFILE=`svcprop -p @PACKAGE_TARNAME@/config_file ${FMRI}`
-PIDFILE=`svcprop -p @PACKAGE_TARNAME@/pid_file ${FMRI}`
-USER=`svcprop -p @PACKAGE_TARNAME@/user ${FMRI}`
-GROUP=`svcprop -p @PACKAGE_TARNAME@/group ${FMRI}`
-VTYADDR=`svcprop -p @PACKAGE_TARNAME@/vty_addr ${FMRI}`
-VTYPORT=`svcprop -p @PACKAGE_TARNAME@/vty_port ${FMRI}`
+svcprop -q -p @PACKAGE_TARNAME@/config_file ${FMRI} && \
+ CONFFILE=`svcprop -p @PACKAGE_TARNAME@/config_file ${FMRI}`
+svcprop -q -p @PACKAGE_TARNAME@/pid_file ${FMRI} && \
+ PIDFILE=`svcprop -p @PACKAGE_TARNAME@/pid_file ${FMRI}`
+svcprop -q -p @PACKAGE_TARNAME@/user ${FMRI} && \
+ USER=`svcprop -p @PACKAGE_TARNAME@/user ${FMRI}`
+svcprop -q -p @PACKAGE_TARNAME@/group ${FMRI} && \
+ GROUP=`svcprop -p @PACKAGE_TARNAME@/group ${FMRI}`
+svcprop -q -p @PACKAGE_TARNAME@/vty_addr ${FMRI} && \
+ VTYADDR=`svcprop -p @PACKAGE_TARNAME@/vty_addr ${FMRI}`
+svcprop -q -p @PACKAGE_TARNAME@/vty_port ${FMRI} && \
+ VTYPORT=`svcprop -p @PACKAGE_TARNAME@/vty_port ${FMRI}`
[ -n "${CONFFILE}" ] && ARGS=" -f ${CONFFILE}"
[ -n "${PIDFILE}" ] && ARGS="${ARGS} --pid_file ${PIDFILE}"
[ -n "${USER}" ] && ARGS="${ARGS} --user ${USER}"
[ -n "${GROUP}" ] && ARGS="${ARGS} --group ${GROUP}"
-[ -n "${VTYPORT}" ] && ARGS="${ARGS} --vty_port ${VTYPORT}"
-[ -n "${VTYADDR}" ] && ARGS="${ARGS} --vty_addr ${VTYADDR}"
+
+# vty should default to disabled, ie port == 0
+[ -z "${VTYPORT}" ] && VTYPORT=0
+ARGS="${ARGS} --vty_port ${VTYPORT}"
+
+# default listen address should be localhost
+[ -z "${VTYADDR}" ] && VTYADDR=127.1
+ARGS="${ARGS} --vty_addr ${VTYADDR}"
# have to have a pid file for script to work
-[ -z "${PIDFILE}" ] && exit $SMF_EXIT_ERR_CONFIG
+# we can assume it otherwise
+if [ -z "${PIDFILE}" ]; then
+ PIDFILE="@quagga_statedir@/${INSTANCE}.pid"
+else
+ ARGS="${ARGS} --pid_file ${PIDFILE}"
+fi
# config file must exist
#[ ! -f "$CONFFILE" ] && exit $SMF_EXIT_ERR_CONFIG
+# we need @quagga_statedir@ to exist, it might be on tmpfs.
+if [ ! -d @quagga_statedir@ ] ; then
+ mkdir -p @quagga_statedir@
+ chown @enable_user@:@enable_group@ @quagga_statedir@
+ chmod 751 @quagga_statedir@
+fi
+
start () {
- /usr/local/quagga/sbin/${DAEMON} ${ARGS} &
+ @sbindir@/${INSTANCE} ${ARGS} &
}
stop () {
@@ -76,9 +98,9 @@ stop () {
}
restart() {
- stop ${DAEMON}
+ stop ${INSTANCE}
sleep 1
- start ${DAEMON}
+ start ${INSTANCE}
}
case $1 in