Bash code comment clarification
This commit is contained in:
parent
1ef62a2da9
commit
601575e1c0
2 changed files with 10 additions and 8 deletions
|
@ -3,11 +3,13 @@
|
|||
# Requires vnstat to be running on target system
|
||||
|
||||
# initial values
|
||||
mtotal=1000 # monthly total in GB for high end cut off
|
||||
dmax=40 # daily max usage value
|
||||
|
||||
# Note comcast caps at 1.2 TB
|
||||
mtotal=1000 # Monthly warning threshold
|
||||
dmax=40 # daily max usage value, trouble might arise if I go past 40 GB a day
|
||||
md=`date +%d` # day of the month numerically
|
||||
cmd=$(($dmax * $md)) # computed max daily
|
||||
wif="eth1.2"
|
||||
cmd=$(($dmax * $md)) # computed max daily, not hard value but can indicate a problem
|
||||
wif="eth1.2" # interface to ask vnstat for, in my case the default wan vlan in Openwrt
|
||||
|
||||
# now vnstat stuff, some of this is specific to openwrt
|
||||
|
||||
|
@ -15,4 +17,5 @@ vnhourly=`vnstat -i $wif -d -s --oneline | awk -F\; '{print $6}'` # total daily
|
|||
vnmonthly=`vnstat -i $wif -d -s --oneline | awk -F\; '{print $11}'` # monthly total usage
|
||||
|
||||
|
||||
logger "dom $md cm $cmd vnhourly $vnhourly vnmonthly $vnmonthly";
|
||||
logger "dom $md cm $cmd vnhourly $vnhourly vnmonthly $vnmonthly"; # Remeber the local syslog on OpenWrt is setup to log to a remote system
|
||||
# therefore this is a lazy way to send the data out
|
||||
|
|
|
@ -8,7 +8,6 @@
|
|||
# note log contains a weeks worth of hourly bandwidth logs and we need the most recent
|
||||
# only
|
||||
|
||||
vndat=`cat /var/log/openwrt.log | grep "root: dom" | tail -n 1`;
|
||||
vndat=`cat /var/log/openwrt.log | grep "root: dom" | tail -n 1`; # Depending on your setup your log file name might be different
|
||||
|
||||
echo "$vndat" > /var/www/html/bnd.dat;
|
||||
# echo "$vndat";
|
||||
echo "$vndat" > /var/www/html/bnd.dat; # your web root may differ
|
Loading…
Add table
Add a link
Reference in a new issue