bird.init 1.7 KB
Newer Older
1 2
#! /bin/sh
#
3
# bird         Starts the Internet Routing Daemon.
4 5 6 7 8 9 10 11 12 13 14 15 16 17
#
# Author:      Ondrej Feela Filip, <feela@network.cz>
#
# chkconfig: - 32 75
# description: Internet routing daemon supporting IPv4 routing protocols:
#              BGP4, RIPv2 and OSPFv2.
#
# processname: bird
# config: /etc/bird.conf


# Source function library.
. /etc/rc.d/init.d/functions

18
[ -f /etc/sysconfig/network ] || exit 0
19

20
. /etc/sysconfig/network
21

22 23 24
BIRD4="yes"
BIRD6="yes"

25 26 27
BIRD4ARGS=
BIRD6ARGS=

28 29 30 31
[ -f /etc/bird.conf ] || BIRD4="no"
[ -f /usr/sbin/bird ] || BIRD4="no"
[ "${NETWORKING}" = "yes" ] || BIRD4="no"

32
[ -f /etc/bird6.conf ] || BIRD6="no"
33 34
[ -f /usr/sbin/bird6 ] || BIRD6="no"
[ "${NETWORKING_IPV6}" = "yes" ] || BIRD6="no"
35

36 37
[ -e /etc/sysconfig/bird ] && . /etc/sysconfig/bird

38 39 40 41 42
RETVAL=0

# See how we were called.
case "$1" in
  start)
43 44 45
	if [ "$BIRD4" = "yes" ]
	then
		echo -n "Starting BIRD for IPv4: "
46
		daemon bird ${BIRD4ARGS}
47 48 49 50 51 52 53
		RETVAL=$?
		echo
		[ $RETVAL -eq 0 ] && touch /var/lock/subsys/bird
	fi
	if [ "$BIRD6" = "yes" ]
	then
		echo -n "Starting BIRD for IPv6: "
54
		daemon bird6 ${BIRD6ARGS}
55 56 57 58
		RETVAL=$?
		echo
		[ $RETVAL -eq 0 ] && touch /var/lock/subsys/bird6
	fi
59 60
	;;
  stop)
61
	echo -n "Stopping BIRD for IPv4: "
62 63 64 65
	killproc bird
	RETVAL=$?
	echo
	[ $RETVAL -eq 0 ] && rm -f /var/lock/subsys/bird
66 67 68 69 70 71

	echo -n "Stopping BIRD for IPv6: "
	killproc bird6
	RETVAL=$?
	echo
	[ $RETVAL -eq 0 ] && rm -f /var/lock/subsys/bird6
72 73 74
	;;
  status)
	status bird
75
	status bird6
76 77 78 79 80 81 82 83
	RETVAL=$?
	;;
  restart)
  	$0 stop
	$0 start
	RETVAL=$?
	;;
  reload)
84 85 86 87 88
	killproc bird -HUP
 	RETVAL=$?
	echo
	echo -n "Reloading BIRD for IPv6: "
	killproc bird6 -HUP
89
	RETVAL=$?
90
	echo
91 92 93 94 95 96
	;;
  *)
	echo "Usage: bird.init {start|stop|status|restart|reload}"
	exit 1
esac

97
exit $RETVAL