summaryrefslogtreecommitdiff
blob: c0a212a4219ecbf4566bc6392ef5f6bfe5d9d812 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
#!/sbin/runscript
# Copyright 1999-2003 Gentoo Technologies, Inc.
# Distributed under the terms of the GNU General Public License v2
# $Header: /var/cvsroot/gentoo-x86/net-misc/zebra/files/init.d/ripd.initd,v 1.1 2003/05/31 19:57:55 solar Exp $


opts="depend checkconfig stop start"

depend() {
	need net zebra
}

checkconfig() {
	if [ ! -e /etc/zebra/zebra.conf ]; then
		eerror "You need to create /etc/zebra/ripd.conf first."
		eerror "An example can be found in /etc/zebra/sample/ripd.conf.sample"
		return 1
	fi
}

stop() {
	ebegin "Stopping ripd"
	start-stop-daemon --stop --quiet --pidfile /var/run/ripd.pid
	result=$?
	eend $result
}

start() {
	local myopts="--daemon"

	[ -n "${RIPD_CONFIG_FILE}" ] && myopts="${myopts} --config_file ${RIPD_CONFIG_FILE}"
	[ -n "${RIPD_VTY_ADDR}" ] && myopts="${myopts} --vty_addr ${RIPD_VTY_ADDR}"
	[ -n "${RIPD_VTY_PORT}" ] && [ "${RIPD_VTY_PORT}" -ge 0 ] && myopts="${myopts} --vty_port ${RIPD_VTY_PORT}"
	[ "x${RIPD_RETAIN}" == "xyes" ] && myopts="${myopts} --retain"

	ebegin "Starting ripd"
	start-stop-daemon --start --quiet --exec /usr/sbin/ripd -- ${myopts}
	result=$?
	eend $result
}