diff options
author | sharpd <sharpd@cumulusnetworks.com> | 2016-02-22 22:22:16 +0100 |
---|---|---|
committer | sharpd <sharpd@cumulusnetworks.com> | 2016-02-23 17:54:01 +0100 |
commit | df44cf00321b5d6c1edae15aa75dd2255d95b476 (patch) | |
tree | 37f9de444686f6b9871e662c53caf4e935da4f22 /tools | |
parent | Merge branch 'cmaster' of ssh://stash.cumulusnetworks.com:7999/quag/quagga in... (diff) | |
download | frr-df44cf00321b5d6c1edae15aa75dd2255d95b476.tar.xz frr-df44cf00321b5d6c1edae15aa75dd2255d95b476.zip |
debian: Revamp startup again
Remove quagga.service, it was a bad idea culminating in a
series of mistakes.
Replaced with /usr/lib/quagga/quagga script.
Use this script to start/stop quagga as a whole.
Ticket: CM-9445
Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
Reviewed-by: Daniel Walton <dwalton@cumulusnetworks.com>
Reviewed-by: Dave Olson <olson@cumulusnetworks.com>
Diffstat (limited to 'tools')
-rwxr-xr-x | tools/quagga | 74 | ||||
-rwxr-xr-x | tools/quagga-reload.py | 4 | ||||
-rwxr-xr-x | tools/startup | 20 |
3 files changed, 76 insertions, 22 deletions
diff --git a/tools/quagga b/tools/quagga new file mode 100755 index 000000000..f96fede6e --- /dev/null +++ b/tools/quagga @@ -0,0 +1,74 @@ +#!/bin/bash + +startup() +{ + FILE="/var/run/quagga/$1.was_running" + + /bin/systemctl reset-failed $1 + + if [ -e $FILE ] + then + rm $FILE + systemctl start $1 + fi + + /bin/systemctl is-enabled $1 > /dev/null 2>&1 + if [ $? -eq 0 ] + then + systemctl start $1 + fi +} + +start_ospfd_multiinstance() +{ + for instance in $MI; do + echo "Starting $instance" + startup ospfd@$instance + done +} + +start_daemons() +{ + startup zebra + startup bgpd + startup ospfd + startup ospf6d + startup ripd + startup ripngd + startup isisd + start_ospfd_multiinstance +} + +stop_ospfd_multiinstance() +{ + for instance in $MI; do + echo "Stopping instance: $instance" + /bin/systemctl stop ospfd@$instance + done +} + +stop_daemons() +{ + stop_ospfd_multiinstance + /bin/systemctl stop bgpd ospfd ospf6d ripd ripngd isisd zebra +} + +MI=`systemctl list-units 'ospfd@*'| sed -n -e '/@/s/\..*//' -e 's/.*@//p'` +case "$1" in + start) + start_daemons + ;; + stop) + stop_daemons + ;; + restart) + stop_daemons + start_daemons + ;; + reload) + /usr/lib/quagga/quagga-reload.py --reload /etc/quagga/Quagga.conf + exit $? + ;; +esac + +exit 0 diff --git a/tools/quagga-reload.py b/tools/quagga-reload.py index 11266a1a2..258bec083 100755 --- a/tools/quagga-reload.py +++ b/tools/quagga-reload.py @@ -500,7 +500,7 @@ if __name__ == '__main__': print "'service integrated-vtysh-config' is not configured, this is required for 'service quagga reload'" sys.exit(1) - status_error = int(subprocess.call('service quagga status', shell=True)) + status_error = int(subprocess.call('/usr/lib/quagga/quagga status', shell=True)) if status_error: print "quagga is not running" @@ -644,5 +644,5 @@ if __name__ == '__main__': subprocess.call(cmd) if restart_bgp: - cmd = ['sudo', 'service', 'quagga', 'restart', 'bgpd'] + cmd = ['sudo', 'systemctl', 'restart', 'bgpd'] subprocess.call(cmd) diff --git a/tools/startup b/tools/startup deleted file mode 100755 index 7ebb5116a..000000000 --- a/tools/startup +++ /dev/null @@ -1,20 +0,0 @@ -#!/bin/bash -# Script to see if we should startup the particular -# daemon as part of systemd initialization -# If the daemon was running (set by the ExecStopPost -# action in the Unit file ) or if the daemon -# is enabled start it up -FILE="/var/run/quagga/$1.was_running" -if [ -e $FILE ] -then - rm $FILE - systemctl start $1 -fi - -systemctl is-enabled $1 > /dev/null -if [ $? -eq 0 ] -then - systemctl start $1 -fi - -exit 0 |