What's new

[Release] FreshJR Adaptive QOS (Improvements / Custom Rules / and Inner workings)

  • SNBForums Code of Conduct

    SNBForums is a community for everyone, no matter what their level of experience.

    Please be tolerant and patient of others, especially newcomers. We are all here to share and learn!

    The rules are simple: Be patient, be nice, be helpful or be gone!

Status
Not open for further replies.
Make sure bash and bc (via entware) and spdMerlin are installed ... and just run the script by typing its name.
Yep, both installed via entware.

The output is always the same:
Code:
admin@RT-AC86U:/tmp/home/root# /jffs/scripts/autoqos
-sh: /jffs/scripts/autoqos: not found
admin@RT-AC86U:/tmp/home/root# ls /jffs/scripts
FreshJR_QOS                dnsmasq.postconf           firewall-start             ntpmerlin                  scmerlin                   services-stop              www_FreshJR_QoS_Stats.asp
autoqos                    dnsomatic                  nat-start                  post-mount                 service-event              spdmerlin
connmon                    dnsomatic.bak              nsrum                      pre-mount                  services-start             unmount

You can see that it is there...
 
Yep, both installed via entware.

The output is always the same:
Code:
admin@RT-AC86U:/tmp/home/root# /jffs/scripts/autoqos
-sh: /jffs/scripts/autoqos: not found
admin@RT-AC86U:/tmp/home/root# ls /jffs/scripts
FreshJR_QOS                dnsmasq.postconf           firewall-start             ntpmerlin                  scmerlin                   services-stop              www_FreshJR_QoS_Stats.asp
autoqos                    dnsomatic                  nat-start                  post-mount                 service-event              spdmerlin
connmon                    dnsomatic.bak              nsrum                      pre-mount                  services-start             unmount

You can see that it is there...
Try this then rerun.
Code:
dos2unix /jffs/scripts/autoqos
 
I hope this helps somebody ... works ok for me. Again, I am not very proficient at coding, just needed something that works for me.

Code:
#!/opt/bin/bash

######################################################################
# SET-BW-SPEEDS
# Set QoS upload/download speeds using Ookla speedtests and spdMerlin
# Requires bash, bc, and spdMerlin
######################################################################

#Make sure speeds (before scaling) are within these boundaries
# Mainly just to prevent bandwidth from being set too low
# (or too high)... not worried about upper limit but it is there
# for the sake of completeness
download_lower_limit=10  #Mbps
download_upper_limit=50  #Mbps
upload_lower_limit=1.0   #Mbps
upload_upper_limit=50    #Mbps

#Scale average values by this factor
#Adjust to optimize bufferbloat and quality grade at DSLreports.com
down_scale_factor=0.85
up_scale_factor=0.85

#Do we need to disable QoS to get new QoS bandwidth limits
#Maybe not since traffic is from router
disable_qos_to_test=0

#Average download and upload speeds over this many
# consecutive speedtest runs
num_spd_tests=3

#Pause between successive speedtest runs (if num_spd_tests > 1)
pause_between_test=0
#If so, pause for how long (will be used with sleep command)
pause_this_long=1m

#spdMerlin command
spdMer_command="/jffs/scripts/spdmerlin generate"
#spdMer_command="echo DEBUG: spdMerlin executes now"

#Location of upload stats
upload_stats="/jffs/addons/spdmerlin.d/csv/Uploaddaily_WAN.htm"

#Location of download stats
download_stats="/jffs/addons/spdmerlin.d/csv/Downloaddaily_WAN.htm"

#Do you wanna to know what is going on if you manually run this script
show_me=1

######################################################################

#Disable QOS to find upload/download speeds
if (( $disable_qos_to_test )); then
  (( $show_me )) && echo "Disabling QoS while performing speedtests ..."
  nvram set qos_enable=0
  nvram commit
  service restart_qos 1> /dev/null
  service restart_firewall 1> /dev/null
fi

#Calculate average download and upload speeds using spdMerlin
sum_down=0; sum_up=0; x=1
while [ $x -le $num_spd_tests ]
do
  (( $show_me )) && echo -e "\nRunning spdMerlin test #$x of $num_spd_tests ..."
  ${spdMer_command} &> /dev/null
  Mbps_down=$(tail -n1 $download_stats | awk -F ',' '{print $NF}')
  Mbps_up=$(tail -n1 $upload_stats | awk -F ',' '{print $NF}')

  sum_down=$(echo $sum_down+$Mbps_down | bc)
  sum_up=$(echo $sum_up+$Mbps_up | bc)

  if (( $show_me )); then
    echo "===== SpeedTest: $x ====="
    echo Download Speed: $Mbps_down Mbps
    echo Upload Speed: $Mbps_up Mbps
  fi

  x=$(( $x + 1 ))
  (( $pause_between_test )) && (( $x <= $num_spd_tests )) && echo "Sleeping for $pause_this_long ..." && sleep $pause_this_long
done

#Calculate the average values
Mbps_down=$(echo "scale=3; $sum_down/$num_spd_tests" | bc)
Mbps_up=$(echo "scale=3; $sum_up/$num_spd_tests" | bc)
if (( $show_me )) && (( $num_spd_tests > 1 )); then
  echo -e "\n===== Averages: ====="
  echo Download Speed: $Mbps_down Mbps
  echo Upload Speed: $Mbps_up Mbps
fi

#Make sure download and uploads speeds are within defined user-defined limits above
if (( `echo "$Mbps_down < $download_lower_limit" | bc` )); then
   logger " -----> Speedtest avg download speed ($Mbps_down Mbps) was less than lower limit ($download_lower_limit Mbps)"
   (( $show_me )) && echo "Speedtest avg download speed ($Mbps_down Mbps) was less than lower limit ($download_lower_limit Mbps)"
   Mbps_down=$download_lower_limit
elif (( `echo "$Mbps_down > $download_upper_limit" | bc` )); then
   logger " -----> Speedtest avg download speed ($Mbps_down Mbps) was greater than upper limit ($download_upper_limit Mbps)"
   (( $show_me )) && echo "Speedtest avg download speed ($Mbps_down Mbps) was greater than upper limit ($download_upper_limit Mbps)"
   Mbps_down=$download_upper_limit
fi
if (( `echo "$Mbps_up < $upload_lower_limit" | bc` )); then
   logger " -----> Speedtest avg upload speed ($Mbps_up Mbps) was less than lower limit ($upload_lower_limit Mbps)"
   (( $show_me )) && echo "Speedtest avg upload speed ($Mbps_up Mbps) was less than lower limit ($upload_lower_limit Mbps)"
   Mbps_up=$upload_lower_limit
elif (( `echo "$Mbps_up > $upload_upper_limit" | bc` )); then
   logger " -----> Speedtest avg upload speed ($Mbps_up Mbps) was greater than upper limit ($upload_upper_limit Mbps)"
   (( $show_me )) && echo "Speedtest avg upload speed ($Mbps_up Mbps) was greater than upper limit ($upload_upper_limit Mbps)"
   Mbps_up=$upload_upper_limit
fi

#Convert to Kbps
#Could simplify this but want to know scaled Mbps so that it can be reported
Mbps_down=$(echo $Mbps_down*$down_scale_factor | bc)
Mbps_up=$(echo $Mbps_up*$up_scale_factor | bc)
Kbps_down=$(echo $Mbps_down*1024 | bc)
Kbps_up=$(echo $Mbps_up*1024 | bc)

#Set Download Limit
logger " -----> Setting QoS Download Speed to $Mbps_down Mbps ..."
(( $show_me )) && echo -e "\nAfter scaling by $down_scale_factor, setting QoS Download Speed to $Mbps_down Mbps ..."
nvram set qos_ibw=$Kbps_down

#Set Upload Limit
logger " -----> Setting QoS Upload Speed to $Mbps_up Mbps ..."
(( $show_me )) && echo "After scaling by $up_scale_factor, setting QoS Upload Speed to $Mbps_up Mbps ..."
nvram set qos_obw=$Kbps_up

#Re-Enable QoS if it was disabled to perform speedtest
if (( $disable_qos_to_test )); then
  (( $show_me )) && echo "Re-enabling QoS now that speedtest are done ..."
  nvram set qos_enable=1
fi
nvram commit
service restart_qos 1> /dev/null
service restart_firewall 1> /dev/null
(( $show_me )) && echo "Done."
exit 0;

@Jack Yaz , consider to put that script/feature on your spdMerlin code, with the proper credits!
It works great.
 
@Jack Yaz , consider to put that script/feature on your spdMerlin code, with the proper credits!
It works great.
I'm trying to install, what numbers do I change/edit within the script? Or does the script does everything automatically? Thanks.
 
I just saw the new update for QoS categories is an update, it seem like we need freshjr to come back and update the scripts to accommodate the changes.
 
I just saw the new update for QoS categories is an update, it seem like we need freshjr to come back and update the scripts to accommodate the changes.
Where,? And for which model?
 
Doubt they will be included anytime soon. Freshjr has been MIA for quite some time.
But I'm not understanding... Where did you read that? I don't know nothing
Edit: mistake, I wanted to quote the other user... Lol
 
Where,? And for which model?
https://www.asus.com/au/Networking/RT-AX88U/HelpDesk_Download/
So far that's what I've seen in assuming it applies to all models with adaptive QoS.
Version 3.0.0.4.384.80182020/03/2771.34 MBytes

ASUS RT-AX88U Firmware version 3.0.0.4.384.8018
1. Update Adaptive QoS categories:
Help you to prioritize the mission-critical applications
Those people who work-from-home & learn-from-home will greatly benefit from this new feature with optimized streaming experiences.
New Supported Categories & Apps:
- Video conferencing, including Microsoft Teams®, ZOOM®, Skype®, Google Hangouts®, BlueJeans®
- Online learning, including Khan academy®, Udemy®, Coursera®, TED®, VIPKiD®, 51Talk®, XDF®, Xueersi®
- Streaming, including YouTube®, Netflix®, HBO NOW®, Amazon Prime Video®, Disney+®, ESPN®, MLB.com®, iQIY®
- Indoor training, including Zwift®, Peloton®, Onelap®
Stay tuned and more apps are coming to the list soon!

2. Support Mobile Game Mode
- One-click prioritizing your mobile device to the highest and ensure you the best mobile gaming experiences.
- Install/Update ASUS Router App (Android supports later than 1.0.0.5.44; iOS supports later than 1.0.0.5.41)

3. Bug fix
- Fixed wan detection bugs
- Improved some connection issues.
 
I just saw the new update for QoS categories is an update, it seem like we need freshjr to come back and update the scripts to accommodate the changes.

This is good news if it makes QoS work better, but bad news if it "breaks" the esteemed FreshJR QoS tweaks we have come to know and love ...
:(
 
This is good news if it makes QoS work better, but bad news if it "breaks" the esteemed FreshJR QoS tweaks we have come to know and love ...
:(
I havent been using A. QoS due to the "upload" being broken at this time for the RT-AX88U. Hope its fixed with this new FW.
 
Status
Not open for further replies.

Support SNBForums w/ Amazon

If you'd like to support SNBForums, just use this link and buy anything on Amazon. Thanks!

Sign Up For SNBForums Daily Digest

Get an update of what's new every day delivered to your mailbox. Sign up here!
Top