Skip to content

Instantly share code, notes, and snippets.

@juji
Created July 10, 2024 13:03
Show Gist options
  • Save juji/10e72c4db910f4f9454f03814b326ad1 to your computer and use it in GitHub Desktop.
Save juji/10e72c4db910f4f9454f03814b326ad1 to your computer and use it in GitHub Desktop.
Wget Download File
#!/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