summaryrefslogtreecommitdiff
blob: 7ad210f0c785c378aeb7b5aaed858f4dd532cfbc (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
#!/sbin/runscript
# Copyright 1999-2007 Gentoo Foundation
# Distributed under the terms of the GNU General Public License, v2 or later
# $Header: /var/cvsroot/gentoo-x86/sys-fs/owfs/files/owserver.initd,v 1.3 2007/12/17 17:41:52 wschlich Exp $

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

depend() {
	need net
	use logger
}

start() {
	ebegin "Starting ${SVCNAME}"
	start-stop-daemon --start --exec /usr/bin/${PROGRAM} \
		--pidfile ${PIDFILE} -c ${OWUID}:${OWGID} -- \
		--pid_file ${PIDFILE} \
		--background --error_print 1 \
		${OWSERVER_OPTS:---nozero -p 127.0.0.1:4304 -d /dev/ttyS0}
	eend $?
}

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