Update bluez-utils to 3.36 (#3765)
[openwrt/svn-archive/archive.git] / net / darkstat / files / darkstat.init
1 #!/bin/sh /etc/rc.common
2 # Copyright (C) 2007 OpenWrt.org
3
4 START=60
5 BIN=darkstat
6 RUN_D=/var/empty
7 PID_F=$RUN_D/$BIN.pid
8
9 start() {
10 mkdir -p $RUN_D
11 config_load darkstat
12 config_foreach start_darkstat darkstat
13 }
14
15 start_darkstat() {
16 local cfg="$1"
17 config_get interface "$cfg" interface
18 config_get httpaddr "$cfg" httpaddr
19 config_get httpport "$cfg" httpport
20
21 include /lib/network
22 scan_interfaces
23 config_get ifname "$interface" ifname
24
25 $BIN --debug -i "$interface" \
26 ${httpaddr:+-b "$httpaddr"} \
27 ${httpport:+-p "$httpport"}
28 }
29
30
31 stop() {
32 ps aux | grep nobody | grep darkstat | awk '{print }' | \
33 xargs kill 2> /dev/null
34 }
35