LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Networking (https://www.linuxquestions.org/questions/linux-networking-3/)
-   -   DD-WRT Data Usage/Tracking Software...Pausing Data Record During Free Time (https://www.linuxquestions.org/questions/linux-networking-3/dd-wrt-data-usage-tracking-software-pausing-data-record-during-free-time-4175489972/)

surfninja 01-03-2014 02:03 AM

DD-WRT Data Usage/Tracking Software...Pausing Data Record During Free Time
 
-Hello all, Im extremely new to Linux and Im trying to setup a network of about 8 users on a Satellite internet system that has limited monthly bandwidth.
-I have DD-WRT on my routers and using "Yet Another Monitor" software to track each Mac Address data usage.
-It works great, however I would like it to stop/pause recording user data during the free hours of 3:30AM to 8:30AM.
-In CronJobs of DD-WRT I was able to call the shutdown script at 3:30 and startup script at 830 but it seems it was still keeping track of users downloads during that time. The graph looks like it stopped during those hours but when it starts again at 8:30, there is a massive amount of bandwidth used.
-Im thinking it records it and waits til 830 to present it.
-Here is the piece of the code that I think i need to pause or turn off for that time period.
-Thanks for reading and any feedback is very welcome.
# ==========================================================
# Main program
# ==========================================================
_lockDir=/tmp/ACMON-lock
if [ ! -d "$_lockDir" ] ; then
mkdir "$_lockDir"
echo '
---------------------------------------
Starting the Yet Another Monitor script
=======================================
'
else
echo "*** Another instance of this script is already running!!!"
echo "*** You must either run 'rm /tmp/ac_mon.lock' or run 'yamon.shutdown' to launch this script again"
exit 0
fi
started=false
#set _configFile to the first parameter passed to the script
_configFile=$1
setDefaults
readConfig
started=true

_iteration=0
# main loop... to break the loop either edit config.file or delete _lockDir (/tmp/ac_mon.lock)
while [ "$_monitoring" = "1" ] && [ -d $_lockDir ]; do
_iteration=$(($_iteration%($_updateInterval*$_publishInterval) + 1))
if [ "$_paused" = "0" ] ; then
updateUsers
setupIPRules
sleep "$_updatefreq"
#Check for a publish
if [ $(($_iteration%$_updateInterval)) -eq 0 ]; then
updateUsage
fi
#Check for a publish
if [ $(($_iteration%$_publishInterval)) -eq 0 ]; then
publishData
fi
fi
#Check to see whether config.file has changed
readConfig
#Check to see whether the date has changed
_cDay=`date +%d`
if [ "$_doDailyBU" = "1" ] && [ "$_cDay" != "$_pDay" ] ; then
dailyBU
fi
_pDay="$_cDay"
# Commented out because not the ps call is not well supported across all firmware builds
# ni=`ps cax | grep -c yamon`
# " >>> Number of YAMon instances: $ni." 0
# if [ $ni -gt 2 ]; then
# send2log " !!! Incorrect number of YAMon instances???: $ni." 2
# fi

#one last backup before shutting down
if [ "$_monitoring" = "0" ] || [ ! -d $_lockDir ]; then
[ -d $_lockDir ] && rmdir $_lockDir
send2log "
=====================================
Stopped AC Monitor script
-------------------------------------
" 2
sleep 10
fi
done &


All times are GMT -5. The time now is 03:07 PM.