summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEsteban Carnevale <alfplayer@mailoo.org>2014-11-05 11:36:22 -0300
committerEsteban Carnevale <alfplayer@mailoo.org>2014-11-05 11:36:22 -0300
commitccc52ff7af91a1950143c14903df8767f3dbb173 (patch)
tree2e3ca78ce366c4c8a11b2fd611a79696239b2dc1
parentca9fc26153909ab3758bfce9343db821a532515a (diff)
parabola-mirrors-online-test: Add script
-rwxr-xr-xparabola-mirrors-online-test41
1 files changed, 41 insertions, 0 deletions
diff --git a/parabola-mirrors-online-test b/parabola-mirrors-online-test
new file mode 100755
index 0000000..b866a83
--- /dev/null
+++ b/parabola-mirrors-online-test
@@ -0,0 +1,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