summaryrefslogtreecommitdiff
blob: 08b3a88fc93cec92b288260e98d17a9fd163675c (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-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/ospfd.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/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
}