From 601575e1c0775345fd1e2e5cc5a2a06b0b644a7d Mon Sep 17 00:00:00 2001 From: Paul M Date: Mon, 3 May 2021 22:32:57 -0500 Subject: [PATCH] Bash code comment clarification --- Bash/OpenWrt/band.bash | 13 ++++++++----- Bash/Raspberry Pi/bndweb.bash | 5 ++--- 2 files changed, 10 insertions(+), 8 deletions(-) diff --git a/Bash/OpenWrt/band.bash b/Bash/OpenWrt/band.bash index 7da09c4..6e3e11b 100644 --- a/Bash/OpenWrt/band.bash +++ b/Bash/OpenWrt/band.bash @@ -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 diff --git a/Bash/Raspberry Pi/bndweb.bash b/Bash/Raspberry Pi/bndweb.bash index d3709fa..59baf86 100644 --- a/Bash/Raspberry Pi/bndweb.bash +++ b/Bash/Raspberry Pi/bndweb.bash @@ -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 \ No newline at end of file