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

Fix test upload speed to server

This commit is contained in:
Ycarus (Yannick Chabanois) 2023-12-14 16:22:12 +01:00
parent f5b2a50a11
commit 59953aff5f

View file

@ -48,9 +48,22 @@ if [ -n "$HOST" ] && [ -n "$PORT" ] && [ -n "$USERNAME" ] && [ -n "$PASSWORD" ];
# /etc/init.d/omr-tracker stop 2>&1 >/dev/null # /etc/init.d/omr-tracker stop 2>&1 >/dev/null
# multipath ${INTERFACE} off # multipath ${INTERFACE} off
#fi #fi
if [ -n "$UPLOAD" ]; then
if [ -f /usr/bin/v2ray ]; then
upload_file="/usr/bin/v2ray"
elif [ -f /usr/bin/xray ]; then
upload_file="/usr/bin/xray"
elif [ -f /boot/vmlinuz ]; then
upload_file="/boot/vmlinuz"
elif [ -f /bin/bash ]; then
upload_file="/bin/bash"
else
upload_file="/bin/busybox"
fi
fi
if [ -n "$FASTTEST" ]; then if [ -n "$FASTTEST" ]; then
if [ -n "$UPLOAD" ]; then if [ -n "$UPLOAD" ]; then
avg_speed=$(curl -k --max-time 30 -o /dev/null -qfsS -w '%{speed_upload}' -X POST -d @/boot/vmlinuz -d @/boot/vmlinuz --interface $INTERFACE -H "Authorization: Bearer ${KEY}" https://${HOST}:${PORT}/speedtest 2>/dev/null) avg_speed=$(curl -k --max-time 30 -o /dev/null -qfsS -w '%{speed_upload}' -X POST -d @${upload_file} -d @${upload_file} --interface $INTERFACE -H "Authorization: Bearer ${KEY}" https://${HOST}:${PORT}/speedtest 2>/dev/null)
echo -n "$avg_speed" echo -n "$avg_speed"
else else
avg_speed=$(curl -k --max-time 30 -o /dev/null -qfsS -w '%{speed_download}' --interface $INTERFACE -H "Authorization: Bearer ${KEY}" https://${HOST}:${PORT}/speedtest 2>/dev/null) avg_speed=$(curl -k --max-time 30 -o /dev/null -qfsS -w '%{speed_download}' --interface $INTERFACE -H "Authorization: Bearer ${KEY}" https://${HOST}:${PORT}/speedtest 2>/dev/null)
@ -58,7 +71,7 @@ if [ -n "$HOST" ] && [ -n "$PORT" ] && [ -n "$USERNAME" ] && [ -n "$PASSWORD" ];
fi fi
else else
if [ -n "$UPLOAD" ]; then if [ -n "$UPLOAD" ]; then
curl -k -o /dev/null -X POST -d @/boot/vmlinuz -d @/boot/vmlinuz --interface $INTERFACE -H "Authorization: Bearer ${KEY}" https://${HOST}:${PORT}/speedtest || echo curl -k -o /dev/null -X POST -d @${upload_file} -d @${upload_file} --interface $INTERFACE -H "Authorization: Bearer ${KEY}" https://${HOST}:${PORT}/speedtest || echo
else else
curl -k -o /dev/null --interface $INTERFACE -H "Authorization: Bearer ${KEY}" https://${HOST}:${PORT}/speedtest || echo curl -k -o /dev/null --interface $INTERFACE -H "Authorization: Bearer ${KEY}" https://${HOST}:${PORT}/speedtest || echo
fi fi