summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStephen Hemminger <stephen.hemminger@vyatta.com>2009-02-05 11:43:31 -0800
committerStephen Hemminger <stephen.hemminger@vyatta.com>2009-02-05 11:43:31 -0800
commit1a7d69a1db8249754ff3a0b43270fb6bfb5d6764 (patch)
tree1caa26321dd5ed6d8951629c9b304badce64e483
parentca234139fa6b8ce95c144e422973fd5346e02c14 (diff)
downloadvyatta-cfg-quagga-1a7d69a1db8249754ff3a0b43270fb6bfb5d6764.tar.gz
vyatta-cfg-quagga-1a7d69a1db8249754ff3a0b43270fb6bfb5d6764.zip
Manage daemons better
1. Shutdown bgp on last neighbor removed 2. use daemon name consistently 3. change options to watchquagga
-rwxr-xr-xscripts/vyatta-protocol15
-rw-r--r--templates/protocols/bgp/node.def6
-rw-r--r--templates/protocols/ospf/node.def4
-rw-r--r--templates/protocols/rip/node.def4
-rw-r--r--templates/protocols/ripng/node.def4
5 files changed, 18 insertions, 15 deletions
diff --git a/scripts/vyatta-protocol b/scripts/vyatta-protocol
index 4ff0c941..d82e821d 100755
--- a/scripts/vyatta-protocol
+++ b/scripts/vyatta-protocol
@@ -4,7 +4,7 @@
#
progname=$0
usage() {
- echo "Usage: $progname {start|stop|reload} {bgp|ospf|rip|ripng}"
+ echo "Usage: $progname {start|stop|reload} {bgpd|ospfd|ripd|ripngd}"
exit 1;
}
@@ -12,8 +12,7 @@ if [ $# -lt 2 ]; then
usage
fi
-protocol=$2
-daemon=${protocol}d
+daemon=$2
exe_file=/usr/sbin/vyatta-$daemon
pid_dir=/var/run/vyatta/quagga
@@ -21,7 +20,7 @@ pid_file=$pid_dir/${daemon}.pid
log_dir=/var/log/vyatta/quagga
if [ ! -x $exe_file ]; then
- echo "Unknown protocol: $protocol";
+ echo "Unknown daemon $daemon"
exit 1;
fi
@@ -33,9 +32,9 @@ case "$1" in
-- -d -P 0 -i $pid_dir/${daemon}.pid
sudo start-stop-daemon --start --quiet \
--chdir $log_dir \
- --pidfile $pid_dir/watch-${daemon}.pid \
--exec /usr/sbin/vyatta-watchquagga \
- -- -dz -R "/opt/vyatta/sbin/vyatta-quagga reload $protocol" $daemon
+ -- -p $pid_dir/watch-${daemon}.pid \
+ -dz -r "/opt/vyatta/sbin/vyatta-quagga reload %s" $daemon
;;
stop)
@@ -55,11 +54,11 @@ case "$1" in
trap "/opt/vyatta/sbin/vyatta-cfg-cmd-wrapper end" EXIT HUP INT QUIT TERM
# Save current configuration
- tmp=/tmp/${protocol}-restart.$$
+ tmp=/tmp/${daemon}-restart.$$
/opt/vyatta/sbin/vyatta-save-config.pl $tmp || exit 1
# Erase active configuration for that protocol
- rm -fr /opt/vyatta/config/active/protocols/$protocol
+ rm -fr /opt/vyatta/config/active/protocols/${daemon/%d/}
# Reload causing configuration to activate - implies commit
# remove tmp file if successful
diff --git a/templates/protocols/bgp/node.def b/templates/protocols/bgp/node.def
index ef80d812..ca1ae005 100644
--- a/templates/protocols/bgp/node.def
+++ b/templates/protocols/bgp/node.def
@@ -6,10 +6,14 @@ syntax:expression: $VAR(@) >= 1 && $VAR(@) <= 4294967294 ; \
"AS number must be between 1 and 4294967294"
create: if [ $(pgrep -c -x vyatta-bgpd) -eq 0 ]
- then /opt/vyatta/sbin/vyatta-protocol start bgp
+ then ${vyatta_sbindir}/vyatta-protocol start bgpd
fi
vyatta-vtysh -c "configure terminal" -c "router bgp $VAR(@)"
update: vyatta-vtysh -c "configure terminal" -c "router bgp $VAR(@)" \
-c "bgp network import-check"
delete: vyatta-vtysh -c "configure terminal" -c "no router bgp $VAR(@)"
+ if ! ${vyatta_sbindir}/vyatta-check-typeless-node.pl "protocols bgp"
+ then ${vyatta_sbindir}/vyatta-protocol stop bgpd
+ fi
+
diff --git a/templates/protocols/ospf/node.def b/templates/protocols/ospf/node.def
index 25ef78e3..5405abac 100644
--- a/templates/protocols/ospf/node.def
+++ b/templates/protocols/ospf/node.def
@@ -1,5 +1,5 @@
help: Configure Open Shortest Path First protocol (OSPF) parameters
-create: /opt/vyatta/sbin/vyatta-protocol start ospf
+create: /opt/vyatta/sbin/vyatta-protocol start ospfd
vyatta-vtysh -c "configure terminal" -c "router ospf"
delete: vyatta-vtysh -c "configure terminal" -c "no router ospf"
- /opt/vyatta/sbin/vyatta-protocol stop ospf
+ /opt/vyatta/sbin/vyatta-protocol stop ospfd
diff --git a/templates/protocols/rip/node.def b/templates/protocols/rip/node.def
index f1a08cc5..a77bdb30 100644
--- a/templates/protocols/rip/node.def
+++ b/templates/protocols/rip/node.def
@@ -1,7 +1,7 @@
help: Configure Routing Information Protocol (RIP) parameters
-create: /opt/vyatta/sbin/vyatta-protocol start rip
+create: /opt/vyatta/sbin/vyatta-protocol start ripd
vyatta-vtysh -c "configure terminal" -c "router rip"
delete: vyatta-vtysh -c "configure terminal" -c "no router rip"
- /opt/vyatta/sbin/vyatta-protocol stop rip
+ /opt/vyatta/sbin/vyatta-protocol stop ripd
diff --git a/templates/protocols/ripng/node.def b/templates/protocols/ripng/node.def
index efe56ba3..18735607 100644
--- a/templates/protocols/ripng/node.def
+++ b/templates/protocols/ripng/node.def
@@ -1,5 +1,5 @@
help: Configure Routing Information Protocol (RIPng) parameters
-create: /opt/vyatta/sbin/vyatta-protocol start ripng
+create: /opt/vyatta/sbin/vyatta-protocol start ripngd
vyatta-vtysh -c "configure terminal" -c "router ripng"
delete: vyatta-vtysh -c "configure terminal" -c "no router ripng"
- /opt/vyatta/sbin/vyatta-protocol stop ripng
+ /opt/vyatta/sbin/vyatta-protocol stop ripngd