50 lines
1 KiB
Text
50 lines
1 KiB
Text
#!/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"
|
|
}
|