summaryrefslogtreecommitdiff
blob: 328c233e165246cd149c0a2f71dc2c826af48c40 (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
51
#!/sbin/openrc-run
# Copyright 1999-2016 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Id$

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"
}