summaryrefslogtreecommitdiff
blob: 4a72c23bf8804c8836387122a54f0cd27a99a362 (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
#!/sbin/openrc-run
# 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 $?
}