summaryrefslogtreecommitdiff
path: root/parabola-mirrors-online-test
blob: b866a83aab3c79aa24905030163eb9ce6d83608b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
#!/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