]>
Commit | Line | Data |
---|---|---|
df44cf00 | 1 | #!/bin/bash |
2 | ||
3 | startup() | |
4 | { | |
5 | FILE="/var/run/quagga/$1.was_running" | |
6 | ||
cea35078 | 7 | /bin/systemctl reset-failed $1 > /dev/null 2>&1 |
df44cf00 | 8 | |
9 | if [ -e $FILE ] | |
10 | then | |
11 | rm $FILE | |
cea35078 | 12 | /bin/systemctl start $1 > /dev/null 2>&1 |
df44cf00 | 13 | fi |
14 | ||
15 | /bin/systemctl is-enabled $1 > /dev/null 2>&1 | |
16 | if [ $? -eq 0 ] | |
17 | then | |
cea35078 | 18 | /bin/systemctl start $1 > /dev/null 2>&1 |
df44cf00 | 19 | fi |
20 | } | |
21 | ||
22 | start_ospfd_multiinstance() | |
23 | { | |
24 | for instance in $MI; do | |
df44cf00 | 25 | startup ospfd@$instance |
26 | done | |
27 | } | |
28 | ||
29 | start_daemons() | |
30 | { | |
31 | startup zebra | |
32 | startup bgpd | |
33 | startup ospfd | |
34 | startup ospf6d | |
35 | startup ripd | |
36 | startup ripngd | |
37 | startup isisd | |
38 | start_ospfd_multiinstance | |
39 | } | |
40 | ||
41 | stop_ospfd_multiinstance() | |
42 | { | |
43 | for instance in $MI; do | |
cea35078 | 44 | /bin/systemctl stop ospfd@$instance > /dev/null 2>&1 |
df44cf00 | 45 | done |
46 | } | |
47 | ||
48 | stop_daemons() | |
49 | { | |
50 | stop_ospfd_multiinstance | |
cea35078 | 51 | /bin/systemctl stop bgpd ospfd ospf6d ripd ripngd isisd zebra > /dev/null 2>&1 |
df44cf00 | 52 | } |
53 | ||
54 | MI=`systemctl list-units 'ospfd@*'| sed -n -e '/@/s/\..*//' -e 's/.*@//p'` | |
55 | case "$1" in | |
56 | start) | |
57 | start_daemons | |
58 | ;; | |
59 | stop) | |
60 | stop_daemons | |
61 | ;; | |
62 | restart) | |
63 | stop_daemons | |
64 | start_daemons | |
65 | ;; | |
66 | reload) | |
67 | /usr/lib/quagga/quagga-reload.py --reload /etc/quagga/Quagga.conf | |
68 | exit $? | |
69 | ;; | |
3de8e929 DS |
70 | status) |
71 | systemctl -l -o cat -n0 status zebra bgpd ospfd ospf6d ripd ripngd isisd | |
72 | exit $? | |
73 | ;; | |
c9955087 DS |
74 | help) |
75 | man -s 1 quagga | |
db0f7939 | 76 | ;; |
3de8e929 DS |
77 | *) |
78 | echo "Unknown option entered" | |
79 | exit -1 | |
80 | ;; | |
df44cf00 | 81 | esac |
82 | ||
83 | exit 0 |