Skip to content

Commit

Permalink
Update bandwidth_occupier.sh
Browse files Browse the repository at this point in the history
  • Loading branch information
spiritLHLS authored Mar 6, 2023
1 parent ee564f9 commit b378f32
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion bandwidth_occupier.sh
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,11 @@ while [[ -z "$selected_url" ]]; do
selected_url=$url
fi
done
bandwidth=$(speedtest-cli --simple | awk '/^Download/ {print $2}')
if ! command -v speedtest-cli > /dev/null 2>&1; then
bandwidth=$(/usr/local/bin/speedtest-go | awk '/^Download/ {print $2}' | head -2 | tail -1)
else
bandwidth=$(speedtest-cli --simple | awk '/^Download/ {print $2}')
fi
rate=$(echo "($bandwidth * 0.25)/1" | bc)
timeout 10m wget $selected_url --limit-rate=$rate -O /dev/null &
rm "${pid_file}"

0 comments on commit b378f32

Please sign in to comment.