summaryrefslogtreecommitdiffstats
path: root/testing/wifidog/wifidog.initd
blob: c5e3b37f08045245f9e38981b6ea38e9204ee99e (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
37
38
39
#!/sbin/runscript
# Copyright 2012 Nathan Angelacos for Alpine Linux
# Distributed under the terms of the GNU General Public License v2

SVCDIR=${SVCDIR:-/etc/wifidog}
SVC=${SVCNAME#*.}
if [ -n "${SVC}" ] && [ ${SVCNAME} != "wifidog" ]; then
	SVCPID="/var/run/wifidog.${SVC}.pid"
else
	SVCPID="/var/run/wifidog.pid"
fi
SVCCONF="${SVCDIR}/${SVC}.conf"

depend() {
	need  net
	use   dns
}


start() {
	ebegin "Starting ${SVCNAME}"

	start-stop-daemon --start --exec /usr/bin/wifidog -b -m --pidfile "${SVCPID}" \
		-- -f -s -c ${SVCCONF} ${CONF} 2&>1 >/dev/null
	if ! [ -d /proc/`cat ${SVCPID}` ]; then
		rm -f "${SVCPID}"
		eend 1 
		return 1
	fi
	eend 0
}

stop() {
	ebegin "Stopping ${SVCNAME}"
	start-stop-daemon --stop --quiet \
		--exec /usr/sbin/wifidog --pidfile "${SVCPID}"
	eend $?
}