summaryrefslogtreecommitdiff
blob: 9e6f9798a0edee3941dac8e394f7dc27f3f0e038 (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
#!/sbin/runscript
# Copyright 1999-2004 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: /var/cvsroot/gentoo-x86/net-misc/zebra/files/init.d/ospfd.initd,v 1.2 2004/07/15 00:16:56 agriffis 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/ospfd.conf first."
		eerror "An example can be found in /etc/zebra/sample/ospfd.conf.sample"
		return 1
	fi
}

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

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

	[ -n "${OSPFD_CONFIG_FILE}" ] && myopts="${myopts} --config_file ${OSPFD_CONFIG_FILE}"
	[ -n "${OSPFD_VTY_ADDR}" ] && myopts="${myopts} --vty_addr ${OSPFD_VTY_ADDR}"
	[ -n "${OSPFD_VTY_PORT}" ] && [ "${OSPFD_VTY_PORT}" -ge 0 ] && myopts="${myopts} --vty_port ${OSPFD_VTY_PORT}"

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