From 55c563c5482c95fb81c7e18a0e16aade07ffb2dc Mon Sep 17 00:00:00 2001 From: Stephen Hemminger Date: Mon, 9 Mar 2009 22:40:43 -0700 Subject: Manage daemon restart correctly Need to look at exists (after commit) rather than original list of daemons. Bug 4192 --- scripts/quagga-manager | 40 ++++++++++++++++++++-------------------- 1 file changed, 20 insertions(+), 20 deletions(-) (limited to 'scripts') diff --git a/scripts/quagga-manager b/scripts/quagga-manager index dc1f3ab5..1a62eabd 100755 --- a/scripts/quagga-manager +++ b/scripts/quagga-manager @@ -35,16 +35,16 @@ start() { zebra) args+=( -l -S -s 1048576 ) ;; watchquagga) args=( -dz -p ${pid_dir}/${daemon}.pid ); - local -a daemons=(`/opt/vyatta/bin/vyatta-show-protocols configured`) - if [ ${#daemons} -eq 0 ] + local -a protocols=(`/opt/vyatta/bin/vyatta-show-protocols exists`) + if [ ${#protocols[*]} -eq 0 ] then # Only zebra: mode 1 simple restart - args+=( -R "$0 zebra restart" ) + args+=( -R "$0 zebra restart" zebra ) else - # Many daemons: phased restart + # With routing protocols: phased restart args+=(-A -r "$0 restart \%s" -s "$0 start \%s" -k "$0 stop \%s" ); + args+=( zebra ${protocols[*]} ) fi - args+=( zebra $daemons ) ;; esac @@ -98,26 +98,26 @@ reload_config() { trap "" EXIT HUP INT QUIT TERM } +update() { + local deleted=`/opt/vyatta/bin/vyatta-show-protocols deleted` + local added=`/opt/vyatta/bin/vyatta-show-protocols added` -case "$1" in - start) start $2;; - stop) stop $2;; + # nothing lost, nothing gained + [ -z "$deleted" -a -z "$added" ] && exit 0 - update) - deleted=`/opt/vyatta/bin/vyatta-show-protocols deleted` - added=`/opt/vyatta/bin/vyatta-show-protocols added` + stop watchquagga + for daemon in $deleted + do stop ${daemon} + done - # nothing lost, nothing gained - [ -z "$deleted" -a -z "$added" ] && exit 0 + start watchquagga +} - stop watchquagga - for daemon in $deleted - do stop ${daemon} - done - - start watchquagga - ;; +case "$1" in + start) start $2;; + stop) stop $2;; + update) update;; restart) # Restart single daemon stop $2 -- cgit v1.2.3