1
0
Fork 0
mirror of https://github.com/Ysurac/openmptcprouter-feeds.git synced 2025-03-09 15:40:03 +00:00

Fix on omr-test-speed for fasttest

This commit is contained in:
Ycarus (Yannick Chabanois) 2023-12-13 10:57:05 +01:00
parent 63d19c4861
commit 7139a5db51
2 changed files with 9 additions and 3 deletions

View file

@ -13,9 +13,10 @@ if [ "$1" = "fasttest" ]; then
fi fi
for i in $@; do :; done for i in $@; do :; done
INTERFACE="$i" INTERFACE="$i"
[ "$INTERFACE" = "forcevps" ] || [ "$INTERFACE" = "fasttest" ] && INTERFACE=""
[ -n "$INTERFACE" ] && [ ! -d "/sys/class/net/$INTERFACE" ] && { [ -n "$INTERFACE" ] && [ ! -d "/sys/class/net/$INTERFACE" ] && {
echo "You must use a real interface. You wan find them using 'ip a' for example" echo "You must use a real interface. You wan find them using 'ip a' for example (not $INTERFACE)"
exit 0 exit 0
} }
@ -41,7 +42,12 @@ done
[ "$FASTTEST" = true ] || echo "Best server is $HOST, running test:" [ "$FASTTEST" = true ] || echo "Best server is $HOST, running test:"
trap : HUP INT TERM trap : HUP INT TERM
if [ -z "$INTERFACE" ]; then if [ -z "$INTERFACE" ]; then
if [ "$FASTTEST" = true ]; then
avg_speed=$(curl -4 --max-time 10 -o /dev/null -qfsS -w '%{speed_download}' $HOST 2>/dev/null)
echo "$avg_speed"
else
curl -4 -o /dev/null $HOST || echo curl -4 -o /dev/null $HOST || echo
fi
else else
[ -n "$(tc qdisc show dev $INTERFACE | grep ingress)" ] && /etc/init.d/sqm stop $INTERFACE [ -n "$(tc qdisc show dev $INTERFACE | grep ingress)" ] && /etc/init.d/sqm stop $INTERFACE
domain=$(echo $HOST | awk -F/ '{print $3}') domain=$(echo $HOST | awk -F/ '{print $3}')

View file

@ -1,5 +1,4 @@
#!/bin/sh #!/bin/sh
#!/bin/sh
# (c) Yannick Chabanois (ycarus@zugaina.org) for OpenMPTCProuter # (c) Yannick Chabanois (ycarus@zugaina.org) for OpenMPTCProuter
# #
# #
@ -14,6 +13,7 @@ if [ "$1" = "fasttest" ]; then
fi fi
for i in $@; do :; done for i in $@; do :; done
INTERFACE="$i" INTERFACE="$i"
[ "$INTERFACE" = "forcevps" ] || [ "$INTERFACE" = "fasttest" ] && INTERFACE=""
[ -n "$INTERFACE" ] && [ ! -d "/sys/class/net/$INTERFACE" ] && { [ -n "$INTERFACE" ] && [ ! -d "/sys/class/net/$INTERFACE" ] && {
echo "You must use a real interface. You wan find them using 'ip a' for example" echo "You must use a real interface. You wan find them using 'ip a' for example"