summaryrefslogtreecommitdiff
blob: 4d7f6d4d1b7079ba52fabe3b0c376341490b4152 (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
36
#!/sbin/openrc-run
# Copyright 1999-2016 Gentoo Foundation
# Distributed under the terms of the GNU General Public License, v2 or later
# $Id$

INSTANCE=${SVCNAME#*.}
PROGRAM=${SVCNAME%%.*}
PIDFILE=${PIDFILE:-/run/owfs/${PROGRAM}.pid}
OWUID=${OWUID:-owfs}
OWGID=${OWGID:-owfs}

depend() {
	need owserver
	use logger
}

start_pre() {
	checkpath -d -m 0750 -o ${OWUID}:${OWGID} "$(dirname ${PIDFILE})"
}

start() {
	ebegin "Starting ${SVCNAME}"
	start-stop-daemon --start --exec /usr/bin/${PROGRAM} \
		--pidfile ${PIDFILE} --user ${OWUID}:${OWGID} -- \
		--pid-file ${PIDFILE} \
		--background --error_print 1 \
		${OWFS_OPTS:--m /var/lib/owfs/mnt --allow_other -s 127.0.0.1:4304}
	eend $?
}

stop() {
	ebegin "Stopping ${SVCNAME}"
	start-stop-daemon --stop --exec /usr/bin/${PROGRAM} \
		--pidfile ${PIDFILE} -u ${OWUID}
	eend $?
}