Browse Source

fix exit

master
lework 5 years ago
parent
commit
699defd0b0
  1. 8
      shell/docker_hub_speed_test.sh

8
shell/docker_hub_speed_test.sh

@ -35,10 +35,16 @@ mirrors=(
function shutdown() { function shutdown() {
tput cnorm # reset cursor tput cnorm # reset cursor
}
function error() {
ps -ef | grep "$0" | awk '{print $2}' | xargs kill -9 '{}' >/dev/null 2>&1 ps -ef | grep "$0" | awk '{print $2}' | xargs kill -9 '{}' >/dev/null 2>&1
} }
trap shutdown EXIT trap shutdown EXIT
trap error ERR 2 3
function spinner() { function spinner() {
# make sure we use non-unicode character type locale # make sure we use non-unicode character type locale
@ -112,7 +118,7 @@ for mirror in ${!mirrors[*]}; do
image_manifests=$(curl -s "${mirror}/v2/library/${image_name}/manifests/${image_tag}" | awk -F'"' '/"blobSum":/ {print $4}') image_manifests=$(curl -s "${mirror}/v2/library/${image_name}/manifests/${image_tag}" | awk -F'"' '/"blobSum":/ {print $4}')
image_layer=$( echo $resp | tr ' ' '\n' | sort -u | head -1) image_layer=$( echo $resp | tr ' ' '\n' | sort -u | head -1)
fi fi
spinner "${mirrors[$mirror]}/v2/${image_name}/blobs/${image_layer}" ${mirror} #spinner "${mirrors[$mirror]}/v2/${image_name}/blobs/${image_layer}" ${mirror}
done done
spinner "https://registry-1.docker.io/v2/${image_name}/blobs/${image_layer}" "docker" "Authorization: Bearer $docker_token" spinner "https://registry-1.docker.io/v2/${image_name}/blobs/${image_layer}" "docker" "Authorization: Bearer $docker_token"

Loading…
Cancel
Save