Martin Winter | fca2c24 | 2015-08-12 17:31:07 -0700 | [diff] [blame] | 1 | #!/bin/bash |
| 2 | # chkconfig: - 16 84 |
| 3 | # config: /etc/quagga/pimd.conf |
| 4 | |
| 5 | ### BEGIN INIT INFO |
| 6 | # Provides: pimd |
| 7 | # Short-Description: PIM multicast routing engine |
| 8 | # Description: PIM routing engine for use with Zebra |
| 9 | ### END INIT INFO |
| 10 | |
| 11 | # source function library |
| 12 | . /etc/rc.d/init.d/functions |
| 13 | |
| 14 | # Get network config |
| 15 | . /etc/sysconfig/network |
| 16 | |
| 17 | # quagga command line options |
| 18 | . /etc/sysconfig/quagga |
| 19 | |
| 20 | RETVAL=0 |
| 21 | PROG="pimd" |
| 22 | cmd=pimd |
| 23 | LOCK_FILE=/var/lock/subsys/pimd |
| 24 | CONF_FILE=/etc/quagga/pimd.conf |
| 25 | |
| 26 | case "$1" in |
| 27 | start) |
| 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 $PIMD_OPTS -f $CONF_FILE |
| 40 | RETVAL=$? |
| 41 | [ $RETVAL -eq 0 ] && touch $LOCK_FILE |
| 42 | echo |
| 43 | ;; |
| 44 | stop) |
| 45 | echo -n $"Shutting down $PROG: " |
| 46 | killproc $cmd |
| 47 | RETVAL=$? |
| 48 | [ $RETVAL -eq 0 ] && rm -f $LOCK_FILE |
| 49 | echo |
| 50 | ;; |
| 51 | restart|reload|force-reload) |
| 52 | $0 stop |
| 53 | $0 start |
| 54 | RETVAL=$? |
| 55 | ;; |
| 56 | condrestart|try-restart) |
| 57 | if [ -f $LOCK_FILE ]; then |
| 58 | $0 stop |
| 59 | $0 start |
| 60 | fi |
| 61 | RETVAL=$? |
| 62 | ;; |
| 63 | status) |
| 64 | status $cmd |
| 65 | RETVAL=$? |
| 66 | ;; |
| 67 | *) |
| 68 | echo $"Usage: $0 {start|stop|restart|reload|force-reload|condrestart|try-restart|status}" |
| 69 | exit 2 |
| 70 | esac |
| 71 | |
| 72 | exit $RETVAL |