1 #!/bin/sh /etc/rc.common
2 # Copyright (C) 2008-2011 OpenWrt.org
12 append cfgs "$cfg_name"
21 config_get_bool _loctmp "$section" "$option"
22 if [ -n "$_loctmp" ]; then
23 conffile="${conffile}$option "
24 if [ 1 -eq "$_loctmp" ]; then
25 conffile="${conffile}true"
27 conffile="${conffile}false"
29 conffile="${conffile}\n"
37 config_get _loctmp "$section" "$option"
38 if [ -n "$_loctmp" ]; then
39 conffile="${conffile}$option ${_loctmp}\n"
47 config_get _loctmp "$section" "$option"
48 if [ -n "$_loctmp" ]; then
49 conffile="${conffile}$option \"${_loctmp}\"\n"
56 [ -d /tmp/bandwidthd ] || mkdir -p /tmp/bandwidthd && cp /www/legend.gif /www/logo.gif /tmp/bandwidthd/
57 [ -e /htdocs ] || ln -s /tmp/bandwidthd /htdocs
58 [ -e /www/bandwidthd ] || ln -s /tmp/bandwidthd /www/bandwidthd
59 rm -f /tmp/bandwidthd.conf
60 touch /tmp/bandwidthd.conf
61 [ -e /etc/bandwidthd.conf ] || ln -s /tmp/bandwidthd.conf /etc/bandwidthd.conf
64 config_load bandwidthd
66 config_get subnets $cfg subnets
67 for subnet in $subnets; do
68 conffile="${conffile}subnet ${subnet}\n"
70 export_string dev $cfg
71 export_number skip_intervals $cfg
72 export_number graph_cutoff $cfg
73 export_bool promiscuous $cfg
74 export_bool output_cdf $cfg
75 export_bool recover_cdf $cfg
76 export_string filter $cfg
77 export_bool graph $cfg
78 export_number meta_refresh $cfg
79 [ -n "$conffile" ] && echo -e "$conffile" >>/tmp/bandwidthd.conf
83 service_start /usr/sbin/bandwidthd
87 service_stop /usr/sbin/bandwidthd