summaryrefslogtreecommitdiff
path: root/net-misc/mrouted/files/mrouted.rc
blob: 62b77e020f5f9cc1402777553dbc6b043a2013f9 (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
41
42
#!/sbin/openrc-run
# Copyright 2004-2026 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2

name="mrouted"
description="IP multicast routing daemon"
command=/usr/sbin/mrouted
mrouted_config="/etc/mrouted.conf"
pidfile="/run/${RC_SVCNAME}.pid"

depend() {
	use logger
	need net
}

checkconfig() {
	if [ ! -e ${mrouted_config} ] ; then
		eerror "You need an ${mrouted_config} file to run mrouted"
		return 1
	fi
}

start_pre() {
        # If this isn't a restart, make sure that the user's config isn't
        # busted before we try to start the daemon (this will produce
        # better error messages than if we just try to start it blindly).
        #
        # If, on the other hand, this *is* a restart, then the stop_pre
        # action will have ensured that the config is usable and we don't
        # need to do that again.
        if [ "${RC_CMD}" != "restart" ] ; then
                checkconfig || return $?
        fi
}

stop_pre() {
	# If this is a restart, check to make sure the user's config
	# isn't busted before we stop the running daemon.
	if [ "${RC_CMD}" = "restart" ] ; then
		checkconfig || return $?
	fi
}