diff options
author | Stephen Hemminger <stephen.hemminger@vyatta.com> | 2009-05-07 12:57:14 -0700 |
---|---|---|
committer | Stephen Hemminger <stephen.hemminger@vyatta.com> | 2009-05-07 12:57:14 -0700 |
commit | 35f0ba84d64566d191e925b2b9a2c36663bce893 (patch) | |
tree | 196874c9b2f018188642f51f90bc3fea1eb8d832 | |
parent | 4c2f025d3d15d3044cd4cc236ec4a1543202b859 (diff) | |
download | quagga-35f0ba84d64566d191e925b2b9a2c36663bce893.tar.bz2 quagga-35f0ba84d64566d191e925b2b9a2c36663bce893.tar.xz |
Updates to init script
1. Don't depend on quagga-manager because later changes may
have to change what it does
2. Add LSB status function
-rwxr-xr-x | debian/vyatta-quagga.init.d | 47 |
1 files changed, 36 insertions, 11 deletions
diff --git a/debian/vyatta-quagga.init.d b/debian/vyatta-quagga.init.d index b4bc3c81..2e197021 100755 --- a/debian/vyatta-quagga.init.d +++ b/debian/vyatta-quagga.init.d @@ -30,24 +30,34 @@ for dir in $pid_dir $log_dir ; do fi done -# Only start zebra here. other daemons started in vyatta config +# Normally only start zebra here. other daemons started in vyatta config +declare -a common_args=( -d -P 0 ) + vyatta_quagga_start () { local -a daemons + if [ $# -gt 0 ] ; then daemons=( $* ) else - # Only start zebra daemons=( zebra ) fi - log_daemon_msg "Starting routing manager" + log_daemon_msg "Starting routing daemons" for daemon in ${daemons[@]} ; do + [ "$daemon" != zebra ] && log_action_cont_msg "$daemon" + + local -a args=( ${common_args[@]} ) + [ "$daemon" = zebra ] && args+=( -l -S -s 1048576 ) + args+=( -i ${pid_dir}/${daemon}.pid ) + + start-stop-daemon --start --quiet --oknodo \ + --chdir $log_dir \ + --exec "/usr/sbin/vyatta-${daemon}" \ + -- $args || \ + ( log_action_end_msg 1 ; return 1 ) log_progress_msg "$daemon" - /opt/vyatta/sbin/quagga-manager start $daemon || \ - ( log_end_msg 1 ; return 1 ) done - log_end_msg $? } vyatta_quagga_stop () @@ -63,8 +73,11 @@ vyatta_quagga_stop () log_action_begin_msg "Stopping routing services" for daemon in ${daemons[@]} ; do - [ -f $pid_dir/${daemon}.pid ] && log_action_cont_msg "$daemon" - /opt/vyatta/sbin/quagga-manager stop $daemon + local pidfile=${pid_dir}/${daemon}.pid + [ -f $pidfile && "$daemon" != zebra ] && log_action_cont_msg "$daemon" + + start-stop-daemon --stop --quiet --oknodo --retry 2 \ + --exec /usr/sbin/vyatta-${daemon} done log_action_end_msg $? @@ -76,15 +89,27 @@ vyatta_quagga_stop () fi } +vyatta_quagga_status () +{ + local pidfile=$pid_dir/zebra.pid + local binpath=/usr/sbin/vyatta-zebra + + status_of_proc -p $pidfile $binpath vyatta-zebra && exit 0 || exit $? +} + case "$action" in start) vyatta_quagga_start $* - ;; - - stop|0) + ;; + + stop) vyatta_quagga_stop $* ;; + status) + vyatta_quagga_status + ;; + restart|force-reload) vyatta_quagga_stop $* sleep 2 |