summaryrefslogtreecommitdiff
blob: 7718da4dae8c6cbf64f951a935c5e116c4278734 (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
#!/sbin/runscript
# Copyright 1999-2012 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Id$

NAME="apt-cacher-ng"
DAEMON="/usr/sbin/$NAME"
RUNDIR="/var/run/$NAME"
PIDFILE="$RUNDIR/$NAME.pid"
SOCKETFILE="$RUNDIR/$NAME.socket"
DAEMON_OPTS="$DAEMON_OPTS pidfile=$PIDFILE SocketPath=$SOCKETFILE foreground=0"

depend() {
	use net
}

start() {
	ebegin "Starting $NAME"
	checkpath -d -m 0755 -o ${NAME}:${NAME} ${RUNDIR}
	start-stop-daemon --start --exec $DAEMON \
	    --user $NAME --group $NAME \
	    --pidfile $PIDFILE \
	    -- $DAEMON_OPTS
	eend $?
}

stop() {
	ebegin "Stopping $NAME"
	start-stop-daemon --stop --retry 15 --exec $DAEMON \
	    --pidfile $PIDFILE
	rm -f $PIDFILE
	eend $?
}