summaryrefslogtreecommitdiff
blob: 9ef420cfad30b0705cecf38b02cd33612a7a63ce (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
43
44
45
46
47
48
49
50
#!/sbin/openrc-run
# Copyright 1999-2016 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2

pidfile="/var/run/logsurfer.pid"
command="/usr/bin/logsurfer"
command_args="-D -p ${pidfile} ${LOGSURFER_OPTS}"
extra_started_commands="reload dump"

conffile="/etc/logsurfer.conf"

depend() {
	use logger
}

checkconfig() {
	if [ ! -f /etc/logsurfer.conf ] ; then
		eerror "Please create /etc/logsurfer.conf"
		return 1
	fi
	return 0
}

start_pre() {
	checkconfig || return $?

	checkpath --file --owner logsurfer --mode 0644 "${pidfile}"
}

start() {
	ebegin "Starting ${SVCNAME}"
	start-stop-daemon \
		--start \
		--user logsurfer \
		--exec ${command} \
		-- ${command_args}
	eend $? "Failed to start ${SVCNAME}"
}

reload() {
	ebegin "Reloading ${SVCNAME}"
	start-stop-daemon --signal HUP --pidfile "${pidfile}"
	eend $? "Failed to reload ${SVCNAME}"
}

dump() {
	ebegin "Dumping ${SVCNAME} internal state"
	start-stop-daemon --signal USR1 --pidfile "${pidfile}"
	eend $? "Failed to dump ${SVCNAME} internal state"
}