diff options
author | Esteban Carnevale <alfplayer@mailoo.org> | 2015-01-28 20:18:43 -0300 |
---|---|---|
committer | Esteban Carnevale <alfplayer@mailoo.org> | 2015-01-28 20:18:43 -0300 |
commit | f6d801c96de0f3d06aa3bf0b4dccc97bc63b2e85 (patch) | |
tree | a5deb253b3e4ef9e657cda50058a10059b8dd5d7 | |
parent | 4a4269039afe21fcfca59bcd1d3d92e198b1297d (diff) |
parabola-mirrors-online-test: Update mirrors, clean up and fix it
-rwxr-xr-x | parabola-mirrors-online-test | 50 |
1 files changed, 34 insertions, 16 deletions
diff --git a/parabola-mirrors-online-test b/parabola-mirrors-online-test index 70b5851..2d6bfa6 100755 --- a/parabola-mirrors-online-test +++ b/parabola-mirrors-online-test @@ -5,37 +5,55 @@ # # Test if mirrors are online. Specifically, it tests the connection to a specific file. -logfile="/var/log/iso-files-online-test.log" +logfile="$HOME/log/iso-files-online-test.log" -[[ -w ${logfile} ]] || { echo -e "Can't write to logfile: ${logfile}\nNothing done." ; exit 1 ; } +logfile_dir="$(dirname ${logfile})" -isodate="2013.04.27" +if [[ ! -w ${logfile_dir} ]] ; then + echo -e "Can't write to logfile directory: \"${logfile_dir}\"\nNothing done." + exit 1 +fi + +isodate="2014.06.01" filename="parabola-${isodate}-dual.iso" -url=("http://alfplayer.com/parabola/iso/${isodate}/${filename}" +url=( + "http://parabolagnulinux.mirrors.linux.ro/iso/${isodate}/${filename}" + "http://alfplayer.com/parabola/iso/${isodate}/${filename}" + "http://snapshots.alfplayer.com/parabola/iso/${isodate}/${filename}" "http://mtjm.eu/releases/parabola/${filename}" # "http://www.fscorsica.org/iso/${filename}" "http://m.tiddles.me/${filename}" # "http://hive.ist.unomaha.edu/parabola/iso/${isodate}/${filename}" "http://repo.parabola.nu/iso/${isodate}/${filename}" "http://oglinzi.ceata.org/parabola-imagini/iso/${isodate}/${filename}" - "https://parabola.goodgnus.com.ar/${isodate}/${filename}" - "http://mirror.yandex.ru/mirrors/parabola/${isodate}/${filename}" - "http://mirror.parlementum.net/${isodate}/${filename}") + "https://parabola.goodgnus.com.ar/iso/${isodate}/${filename}" + "http://mirror.yandex.ru/mirrors/parabola/iso/${isodate}/${filename}" +# "http://mirror.parlementum.net/iso/${isodate}/${filename}" + "http://b.mirrors.fryxell.info/parabolagnulinux/iso/${isodate}/${filename}" # listed using HTTPS in the mirrorlist +) + -urllength=$(( ${#url[@]} - 1 )) +url_length="$(( ${#url[@]} -1 ))" -exist() { curl -s --head "$1" | head -n 1 | grep -q "HTTP/1.[01] [23].." ; } +url_exists() { + curl -s --head "$1" | \ + head -n 1 | \ + grep -q 'HTTP/1.[01] [23]..' +} while true ; do - for (( i=0; i<=urllength; i++ )) ; { - echo "Checking: ${url[i]}" - (( ${urltest[i]} )) || exist "${url[i]}" && { - urltest[i]=1 - echo "$(date '+%Y.%m.%d %R') Found: ${url[i]}" >> "${logfile}" - } - } + for (( i=0; i<=url_length; i++ )) ; do + echo "Checking URL \"${url[$i]}\"" + #(( ${url_test[$i]} )) || url_exists "${url[$i]}" && { + if url_exists "${url[$i]}" ; then + #url_test[$i]=1 + echo "$(date '+%Y.%m.%d %R') Found: ${url[$i]}" >> "${logfile}" + else + echo "$(date '+%Y.%m.%d %R') Not found: ${url[$i]}" >> "${logfile}" + fi + done echo Sleeping... sleep 1800 done |