Last active
October 9, 2020 20:07
-
-
Save juanje/0b49125c848708e0087d2433ab820907 to your computer and use it in GitHub Desktop.
Revisions
-
juanje revised this gist
Oct 9, 2020 . 1 changed file with 2 additions and 2 deletions.There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -19,9 +19,9 @@ function get_file() { # the max number of retries gets reached. until wget -q "${filename}" ; do sleep $wait_time count+= 1 if [ "$count" -eq "$max_retries" ]; then # Max number of retries exceeded echo "It was impossible to download ${filename}." return 1 -
juanje revised this gist
Aug 11, 2020 . 2 changed files with 33 additions and 23 deletions.There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,33 @@ #!/bin/bash URL="http://ipv4.download.thinkbroadband.com/50MB.zip" function get_file() { # Declare these local variables as integer local -i count local -i max_retries local -i wait_time local filename filename="$1" max_retries=5 wait_time=15 count=0 # Loop until the file gets downloaded or # the max number of retries gets reached. until wget -q "${filename}" ; do sleep $wait_time (( count += 1 )) if (( "$count" == "$max_retries" )); then # Max number of retries exceeded echo "It was impossible to download ${filename}." return 1 fi done } # Call the function get_file "${URL}" This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -1,23 +0,0 @@ -
juanje created this gist
Aug 10, 2020 .There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,23 @@ function pull_image() { local version local image local -i count local -i max_retries local -i wait_time version="$1" image="${REGISTRY_URL}/f${version}/fedora-toolbox:${version}" count=0 max_retries=5 wait_time=15 until ${PODMAN} pull "${image}" >/dev/null ; do sleep $wait_time (( count += 1 )) if (( "$count" == "$max_retries" )); then # Max number of retries exceeded echo "Podman couldn't pull the image ${image}." return 1 fi done }