Help to make sh script adjust SQM automaticaly

Try this:

cat /sys/class/net/pppoe-wan/statistics/rx_bytes
cat /sys/class/net/pppoe-wan/statistics/tx_bytes

Replace 'pppoe-wan' with your iface of course, and that's your data point, which is updated in realtime :smiley:

Edit:
Maybe this will help. Its lazy as... but it works over here. I didn't bother adding upload as mine is always constant.

 #set to max bandwidth connection can support
 tc qdisc change root dev ifb4pppoe-wan cake bandwidth 6944Kbit dual-dsthost nat overhead 44 ingress
 #run speedtest
 sh /root/betterspeedtest.sh -t 15 -n 15 -p www.google.com -H netperf-west.bufferbloat.net &
 sleep 4
 sample1=`cat /sys/class/net/pppoe-wan/statistics/rx_bytes`
 sleep 10
 sample2=`cat /sys/class/net/pppoe-wan/statistics/rx_bytes`
 echo Sample1: $sample1
 echo Sample2:	$sample2
 #get average speed for download & upload
 download=$(($sample2-$sample1))
 echo DIFF: $download
 totalkb=$(($download/10))
 downloadKbps=$(($totalkb/125))
 echo CURRENT Kbps: $downloadKbps

 #set to average bandwidth during the test
 tc qdisc change root dev ifb4pppoe-wan cake bandwidth "$downloadKbps"Kbit dual-dsthost nat overhead 44 ingress
 
 echo "auto sqm DONE! Download set to: "$downloadKbps""
3 Likes