mirror of
https://github.com/novatiq/packages.git
synced 2026-04-29 15:08:40 +01:00
darkstat: Network bandwidth monitor - version 3.0.719
Signed-off-by: Jean-Michel Lacroix <lacroix@lepine-lacroix.info> From the oldpackages. Updated to version 3.0.719, new config file to add more options Rewritten init file to take in account the new config file and removing a bug when stopping the daemon. Corrected license information in Makefile Signed-off-by: Jean-Michel Lacroix <lacroix@lepine-lacroix.info>
This commit is contained in:
Executable
+97
@@ -0,0 +1,97 @@
|
||||
#!/bin/sh /etc/rc.common
|
||||
# Copyright (C) 2007-2016 OpenWrt.org
|
||||
|
||||
START=60
|
||||
APP=darkstat
|
||||
RUN_D=/var/empty
|
||||
PID_F=$RUN_D/darkstat.pid
|
||||
|
||||
SYSLOG=""
|
||||
VERBOSE=""
|
||||
NODAEMON=""
|
||||
NOPROMISC=""
|
||||
NODNS=""
|
||||
NOMACS=""
|
||||
NOLASTSEEN=""
|
||||
LOCAL=""
|
||||
paramstr=""
|
||||
|
||||
export_bool () {
|
||||
local option="$1"
|
||||
local section="$2"
|
||||
local _keystr="$3"
|
||||
local _loctmp
|
||||
paramstr=""
|
||||
config_get_bool _loctmp "$section" "$option"
|
||||
if [ -n "$_loctmp" ]; then
|
||||
if [ 1 -eq "$_loctmp" ]; then
|
||||
paramstr="${_keystr} "
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
||||
start() {
|
||||
mkdir -p $RUN_D
|
||||
. /lib/functions/network.sh
|
||||
config_load darkstat
|
||||
config_foreach start_darkstat darkstat
|
||||
}
|
||||
|
||||
start_darkstat() {
|
||||
local cfg="$1"
|
||||
config_get interface $cfg interface
|
||||
export_bool syslog $cfg "--syslog"
|
||||
SYSLOG=$paramstr
|
||||
export_bool verbose $cfg "--verbose"
|
||||
VERBOSE=$paramstr
|
||||
export_bool no_daemon $cfg "--no-daemon"
|
||||
NODAEMON=$paramstr
|
||||
export_bool no_promisc $cfg "--no-promisc"
|
||||
NOPROMISC=$paramstr
|
||||
export_bool no_dns $cfg "--no-dns"
|
||||
NODNS=$paramstr
|
||||
export_bool no_macs $cfg "--no-macs"
|
||||
NOMACS=$paramstr
|
||||
export_bool no_lastseen $cfg "--no-lastseen"
|
||||
NOLASTSEEN=$paramstr
|
||||
config_get httpaddr $cfg httpaddr
|
||||
config_get httpport $cfg httpport
|
||||
config_get network_filter $cfg network_filter
|
||||
config_get network_netmask $cfg network_netmask
|
||||
export_bool local_only $cfg "--local-only"
|
||||
LOCAL=$paramstr
|
||||
config_get hosts_max $cfg hosts_max
|
||||
config_get hosts_keep $cfg hosts_keep
|
||||
config_get ports_max $cfg ports_max
|
||||
config_get ports_keep $cfg ports_keep
|
||||
config_get highest_port $cfg highest_port
|
||||
|
||||
|
||||
network_get_device ifname "$interface" && {
|
||||
/usr/sbin/$APP -i "$ifname" \
|
||||
${SYSLOG} \
|
||||
${VERBOSE} \
|
||||
${NODAEMON} \
|
||||
${NOPROMISC} \
|
||||
${NODNS} \
|
||||
${NOMACS} \
|
||||
${NOLASTSEEN} \
|
||||
${httpaddr:+-b "$httpaddr"} \
|
||||
${httpport:+-p "$httpport"} \
|
||||
${network_filter:+-f "$network_filter"} \
|
||||
${network_netmask:+-l "$network_netmask"} \
|
||||
${LOCAL} \
|
||||
${hosts_max:+--hosts-max "$hosts_max"} \
|
||||
${hosts_keep:+--hosts-keep "$hosts_keep"} \
|
||||
${ports_max:+--ports-max "$ports_max"} \
|
||||
${ports_keep:+--ports-keep "$ports_keep"} \
|
||||
${highest_port:+--highest-port "$highest_port"} \
|
||||
--chroot $RUN_D \
|
||||
--pidfile $PID_F
|
||||
}
|
||||
}
|
||||
|
||||
stop() {
|
||||
start-stop-daemon -K -n $APP -p $PID_F -s TERM
|
||||
rm -f $PID_F
|
||||
}
|
||||
Reference in New Issue
Block a user