2007-04-22 20:09:05 +00:00
|
|
|
#!/bin/sh /etc/rc.common
|
2011-07-03 21:07:13 +00:00
|
|
|
# Copyright (C) 2007-2011 OpenWrt.org
|
2007-04-22 20:09:05 +00:00
|
|
|
|
|
|
|
START=60
|
|
|
|
RUN_D=/var/empty
|
2011-07-03 21:07:13 +00:00
|
|
|
PID_F=$RUN_D/darkstat.pid
|
2007-04-22 20:09:05 +00:00
|
|
|
|
|
|
|
start() {
|
|
|
|
mkdir -p $RUN_D
|
2009-11-23 22:11:42 +00:00
|
|
|
include /lib/network
|
|
|
|
scan_interfaces
|
2007-04-22 20:09:05 +00:00
|
|
|
config_load darkstat
|
|
|
|
config_foreach start_darkstat darkstat
|
|
|
|
}
|
|
|
|
|
|
|
|
start_darkstat() {
|
|
|
|
local cfg="$1"
|
|
|
|
config_get interface "$cfg" interface
|
|
|
|
config_get httpaddr "$cfg" httpaddr
|
|
|
|
config_get httpport "$cfg" httpport
|
|
|
|
|
|
|
|
config_get ifname "$interface" ifname
|
2007-12-30 20:08:09 +00:00
|
|
|
|
2009-11-23 22:11:42 +00:00
|
|
|
/usr/sbin/darkstat --verbose \
|
|
|
|
-i "$ifname" \
|
2008-07-24 10:37:30 +00:00
|
|
|
${httpaddr:+-b "$httpaddr"} \
|
|
|
|
${httpport:+-p "$httpport"} \
|
2011-07-03 21:07:13 +00:00
|
|
|
--chroot $RUN_D \
|
|
|
|
--pidfile $PID_F
|
2007-04-22 20:09:05 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
stop() {
|
2011-07-03 21:07:13 +00:00
|
|
|
service_kill darkstat $PID_F
|
|
|
|
rm -f $PID_F
|
2007-04-22 20:09:05 +00:00
|
|
|
}
|