Created
July 10, 2024 13:03
-
-
Save juji/10e72c4db910f4f9454f03814b326ad1 to your computer and use it in GitHub Desktop.
Wget Download File
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/zsh | |
url="$1" | |
if [ "$url" -eq "" ]; then | |
echo "url can't be empty" | |
echo "usage: download url" | |
exit 1 | |
fi | |
echo start | |
keepWorking=1 | |
while [ "$keepWorking" -eq "1" ]; do | |
wget -c \ | |
--read-timeout=10 \ | |
--waitretry=5 \ | |
--random-wait \ | |
--retry-connrefused \ | |
"$url" | |
if [ "$?" -eq "0" ]; then | |
keepWorking=0 | |
echo "DONE" | |
else | |
echo "will keep on" | |
fi | |
sleep 5 | |
done | |
date |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment