#!/bin/bash # alfplayer # 2014-06-12 # # Test if mirrors are online. Specifically, it tests the connection to a specific file. logfile="/var/log/iso-files-online-test.log" [[ -w ${logfile} ]] || { echo -e "Can't write to logfile: ${logfile}\nNothing done." ; exit 1 ; } isodate="2013.04.27" filename="parabola-${isodate}-dual.iso" url=("http://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.parabolagnulinux.org/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}") urllength=$(( ${#url[@]} - 1 )) exist() { 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}" } } echo Sleeping... sleep 1800 done