summaryrefslogtreecommitdiff
path: root/parabola-mirrors-online-test
blob: 2d6bfa63160f6720dbaf8838cb31d5e9ddad06ff (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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
#!/bin/bash

# alfplayer
# 2014-06-12
#
# Test if mirrors are online. Specifically, it tests the connection to a specific file.

logfile="$HOME/log/iso-files-online-test.log"

logfile_dir="$(dirname ${logfile})"

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://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/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
)


url_length="$(( ${#url[@]} -1 ))"

url_exists() {
	curl -s --head "$1" | \
		head -n 1 | \
		grep -q 'HTTP/1.[01] [23]..'
}

while true ; do
  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