summaryrefslogtreecommitdiff
path: root/net-libs/tox/files/initd
blob: 728cb6f597e78ddbe49d302582f1727919082f7b (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
#!/sbin/runscript

PIDFILE=/run/tox-dht-bootstrap.pid
LOGDIR=/var/log/tox-dht-bootstrap
RUNDIR=/var/lib/tox-dht-bootstrap

depend() {
	need net
}

start() {
	ebegin "Starting tox-dht-bootstrap daemon"

	[ -d "${LOGDIR}" ] || mkdir -p "${LOGDIR}"
	[ -d "${RUNDIR}" ] || mkdir -p "${RUNDIR}"
	chown -R nobody:nobody "${LOGDIR}" "${RUNDIR}"

	start-stop-daemon --start \
		--pidfile "${PIDFILE}" --make-pidfile --background \
		--stdout "${LOGDIR}/stdout" --stderr "${LOGDIR}/stderr" \
		--chdir "${RUNDIR}" \
		--user=nobody --group=nobody \
		--exec /usr/bin/DHT_bootstrap

	eend $?
}

stop() {
	ebegin "Stopping tox-dht-bootstrap daemon"

	start-stop-daemon --stop \
		--pidfile "${PIDFILE}"

	eend $?
}