summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStephen Hemminger <stephen.hemminger@vyatta.com>2009-04-01 17:38:41 -0700
committerStephen Hemminger <stephen.hemminger@vyatta.com>2009-04-02 15:02:57 -0700
commit73712ffe263d0f12cf6db914e9457509bc62f045 (patch)
treeb580e82f3f3a47886e524b9e53c7fa3d6f287ed0
parent7807977e9701dc6acb00ce7bc17d539eb4eed8c3 (diff)
downloadvyatta-cfg-quagga-73712ffe263d0f12cf6db914e9457509bc62f045.tar.gz
vyatta-cfg-quagga-73712ffe263d0f12cf6db914e9457509bc62f045.zip
Don't stop daemon if OSPF/RIP still has parameters
Need daemon to hold around parameters for start.
-rwxr-xr-xscripts/quagga-manager46
1 files changed, 35 insertions, 11 deletions
diff --git a/scripts/quagga-manager b/scripts/quagga-manager
index 40a1ebfe..58c91b66 100755
--- a/scripts/quagga-manager
+++ b/scripts/quagga-manager
@@ -4,7 +4,7 @@
#
# debug
-#echo $* | logger -p local7.debug -t quagga-manager
+# echo $* | logger -p local7.debug -t quagga-manager
usage() {
echo "Usage: $0 {check|start|stop|restart} {bgpd|ospfd|ripd|ospf6d|ripngd}"
@@ -42,6 +42,8 @@ start() {
zebra) args+=( -l -S -s 1048576 ) ;;
watchquagga)
args=( -dz -p ${pid_dir}/${daemon}.pid );
+ # Note: at present ospf/rip only monitored if actually active
+ # probably should get smarter in future here
local -a protocols=(`/opt/vyatta/bin/vyatta-show-protocols exists`)
if [ ${#protocols[*]} -eq 0 ]
@@ -72,16 +74,18 @@ stop() {
rm -f $pid_dir/${daemon}.pid
}
-reload_config() {
+get_protocol() {
local daemon=$1
- local proto
-
- # handle exception...
case $daemon in
- bgpd|ospfd|ripd|ripngd|isisd) proto=${daemon/%d/};;
- ospf6d) proto="ospfv3";;
- *) echo "Unknown daemon $daemon"; exit 1;;
+ bgpd|ospfd|ripd|ripngd|isisd) echo ${daemon/%d/};;
+ ospf6d) echo "ospfv3";;
+ *) echo "Unknown daemon $daemon" 1>&2; exit 1;;
esac
+}
+
+reload_config() {
+ local daemon=$1
+ local proto=$(get_protocol $daemon)
local vyatta_cfg=/opt/vyatta/config/active
local path=$vyatta_cfg/protocols/$proto
@@ -104,8 +108,11 @@ reload_config() {
# special case for interface, remove parameters force reload
case $proto in
- rip|ospf|ripng|ospfv3)
- find $vyatta_cfg/interfaces -type d -name $proto \
+ rip|ospf)
+ find $vyatta_cfg/interfaces -type d -path "*/ip/$proto" \
+ -exec rm -fr '{}' \; ;;
+ ripng|ospfv3)
+ find $vyatta_cfg/interfaces -type d -path "*/ipv6/$proto" \
-exec rm -fr '{}' \; ;;
esac
@@ -117,7 +124,24 @@ reload_config() {
trap "" EXIT HUP INT QUIT TERM
}
+# Check if interface configuration exists for this protocol
+okay_to_stop() {
+ local daemon=$1
+ local proto=$(get_protocol $daemon)
+ local cfg=/opt/vyatta/config/active/interfaces
+
+ case $proto in
+ rip|ospf)
+ return $(find $cfg -type d -path "*/ip/$proto" | wc -l);;
+ ripng|ospfv3)
+ return $(find $cfg -type d -path "*/ipv6/$proto" | wc -l);;
+ *)
+ return 0;;
+ esac
+}
+
update() {
+ # get list of daemons deleted and added in current transaction
local -a deleted=( `/opt/vyatta/bin/vyatta-show-protocols deleted` )
local -a added=( `/opt/vyatta/bin/vyatta-show-protocols added` )
@@ -131,7 +155,7 @@ update() {
for p in ${deleted[*]}
do
# Need daemon to hold state of interface
- if [ -z "$(find $vyatta_cfg/interfaces -type d -name $p)" ]
+ if okay_to_stop $p
then stop $p
fi
done