blob: dfbdd04bb085cb860a8e15dfe06cdd9b250700aa [file] [log] [blame]
#!/sbin/runscript
# Copyright 1999-2014 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Id$
DAEMON="/usr/sbin/${RC_SVCNAME}"
RUNDIR="/var/run/${RC_SVCNAME}"
CACHEDIR="var/cache/${RC_SVCNAME}"
PIDFILE="${RUNDIR}/${RC_SVCNAME}.pid"
SOCKETFILE="${RUNDIR}/${RC_SVCNAME}.socket"
DAEMON_OPTS="${DAEMON_OPTS} pidfile=${PIDFILE} SocketPath=${SOCKETFILE} foreground=0"
depend() {
use net
}
start() {
ebegin "Starting ${RC_SVCNAME}"
checkpath -d -m 0755 -o ${RC_SVCNAME}:${RC_SVCNAME} "${RUNDIR}"
checkpath -d -m 0755 -o ${RC_SVCNAME}:${RC_SVCNAME} "${CACHEDIR}"
start-stop-daemon --start --exec ${DAEMON} \
--user ${RC_SVCNAME} --group ${RC_SVCNAME} \
--pidfile ${PIDFILE} \
-- ${DAEMON_OPTS}
eend $?
}
stop() {
ebegin "Stopping ${RC_SVCNAME}"
start-stop-daemon --stop --retry 15 --exec ${DAEMON} \
--pidfile ${PIDFILE}
rm -f ${PIDFILE}
eend $?
}