paul | 788cdc6 | 2003-01-18 00:22:08 +0000 | [diff] [blame] | 1 | #!/bin/bash |
David Ward | a41242b | 2012-04-29 16:47:07 -0400 | [diff] [blame^] | 2 | # chkconfig: - 16 84 |
3 | # config: /etc/quagga/bgpd.conf | ||||
4 | |||||
5 | ### BEGIN INIT INFO | ||||
6 | # Provides: bgpd | ||||
7 | # Short-Description: BGP routing engine | ||||
8 | # Description: BGP routing engine for use with Zebra | ||||
9 | ### END INIT INFO | ||||
paul | 788cdc6 | 2003-01-18 00:22:08 +0000 | [diff] [blame] | 10 | |
11 | # source function library | ||||
12 | . /etc/rc.d/init.d/functions | ||||
13 | |||||
14 | # Get network config | ||||
15 | . /etc/sysconfig/network | ||||
16 | |||||
paul | 15d74e9 | 2003-12-30 11:16:21 +0000 | [diff] [blame] | 17 | # quagga command line options |
18 | . /etc/sysconfig/quagga | ||||
19 | |||||
paul | 788cdc6 | 2003-01-18 00:22:08 +0000 | [diff] [blame] | 20 | RETVAL=0 |
David Ward | a41242b | 2012-04-29 16:47:07 -0400 | [diff] [blame^] | 21 | PROG="bgpd" |
22 | cmd=bgpd | ||||
23 | LOCK_FILE=/var/lock/subsys/bgpd | ||||
24 | CONF_FILE=/etc/quagga/bgpd.conf | ||||
paul | 788cdc6 | 2003-01-18 00:22:08 +0000 | [diff] [blame] | 25 | |
26 | case "$1" in | ||||
27 | start) | ||||
David Ward | a41242b | 2012-04-29 16:47:07 -0400 | [diff] [blame^] | 28 | # Check that networking is up. |
29 | [ "${NETWORKING}" = "no" ] && exit 1 | ||||
30 | |||||
31 | # The process must be configured first. | ||||
32 | [ -f $CONF_FILE ] || exit 6 | ||||
33 | if [ `id -u` -ne 0 ]; then | ||||
34 | echo $"Insufficient privilege" 1>&2 | ||||
35 | exit 4 | ||||
36 | fi | ||||
37 | |||||
38 | echo -n $"Starting $PROG: " | ||||
39 | daemon $cmd -d $BGPD_OPTS -f $CONF_FILE | ||||
paul | 788cdc6 | 2003-01-18 00:22:08 +0000 | [diff] [blame] | 40 | RETVAL=$? |
David Ward | a41242b | 2012-04-29 16:47:07 -0400 | [diff] [blame^] | 41 | [ $RETVAL -eq 0 ] && touch $LOCK_FILE |
paul | 788cdc6 | 2003-01-18 00:22:08 +0000 | [diff] [blame] | 42 | echo |
43 | ;; | ||||
44 | stop) | ||||
David Ward | a41242b | 2012-04-29 16:47:07 -0400 | [diff] [blame^] | 45 | echo -n $"Shutting down $PROG: " |
46 | killproc $cmd | ||||
paul | 788cdc6 | 2003-01-18 00:22:08 +0000 | [diff] [blame] | 47 | RETVAL=$? |
David Ward | a41242b | 2012-04-29 16:47:07 -0400 | [diff] [blame^] | 48 | [ $RETVAL -eq 0 ] && rm -f $LOCK_FILE |
paul | 788cdc6 | 2003-01-18 00:22:08 +0000 | [diff] [blame] | 49 | echo |
50 | ;; | ||||
David Ward | a41242b | 2012-04-29 16:47:07 -0400 | [diff] [blame^] | 51 | restart|reload|force-reload) |
52 | $0 stop | ||||
53 | $0 start | ||||
paul | 788cdc6 | 2003-01-18 00:22:08 +0000 | [diff] [blame] | 54 | RETVAL=$? |
David Ward | a41242b | 2012-04-29 16:47:07 -0400 | [diff] [blame^] | 55 | ;; |
56 | condrestart|try-restart) | ||||
57 | if [ -f $LOCK_FILE ]; then | ||||
58 | $0 stop | ||||
paul | 788cdc6 | 2003-01-18 00:22:08 +0000 | [diff] [blame] | 59 | $0 start |
David Ward | a41242b | 2012-04-29 16:47:07 -0400 | [diff] [blame^] | 60 | fi |
paul | 788cdc6 | 2003-01-18 00:22:08 +0000 | [diff] [blame] | 61 | RETVAL=$? |
David Ward | a41242b | 2012-04-29 16:47:07 -0400 | [diff] [blame^] | 62 | ;; |
paul | 788cdc6 | 2003-01-18 00:22:08 +0000 | [diff] [blame] | 63 | status) |
David Ward | a41242b | 2012-04-29 16:47:07 -0400 | [diff] [blame^] | 64 | status $cmd |
paul | 788cdc6 | 2003-01-18 00:22:08 +0000 | [diff] [blame] | 65 | RETVAL=$? |
David Ward | a41242b | 2012-04-29 16:47:07 -0400 | [diff] [blame^] | 66 | ;; |
paul | 788cdc6 | 2003-01-18 00:22:08 +0000 | [diff] [blame] | 67 | *) |
David Ward | a41242b | 2012-04-29 16:47:07 -0400 | [diff] [blame^] | 68 | echo $"Usage: $0 {start|stop|restart|reload|force-reload|condrestart|try-restart|status}" |
69 | exit 2 | ||||
paul | 788cdc6 | 2003-01-18 00:22:08 +0000 | [diff] [blame] | 70 | esac |
71 | |||||
72 | exit $RETVAL |