aboutsummaryrefslogtreecommitdiff
path: root/tools/boca-checkinternet
diff options
context:
space:
mode:
authorCassio de Campos <cassiopc@gmail.com>2017-08-29 13:48:42 +0000
committerCassio de Campos <cassiopc@gmail.com>2017-08-29 13:48:42 +0000
commit24e8e000ba6cb5ed671c40ebd7eec01f484aedbf (patch)
tree5a63b8f8a59b1a345214012d01c47c8f5bd29554 /tools/boca-checkinternet
parent170ccee81310850a67e07a6ea9449d911abccf7b (diff)
downloadboca-24e8e000ba6cb5ed671c40ebd7eec01f484aedbf.tar.gz
boca-24e8e000ba6cb5ed671c40ebd7eec01f484aedbf.zip
extra file
Diffstat (limited to 'tools/boca-checkinternet')
-rwxr-xr-xtools/boca-checkinternet35
1 files changed, 35 insertions, 0 deletions
diff --git a/tools/boca-checkinternet b/tools/boca-checkinternet
new file mode 100755
index 0000000..560afef
--- /dev/null
+++ b/tools/boca-checkinternet
@@ -0,0 +1,35 @@
+#!/bin/bash
+
+debug=0
+if [ "$1" == "-d" -o "$1" == "--debug" -o "$1" == "debug" ]; then
+ debug=1
+fi
+
+wget -4 -t 2 -T 7 -O - http://www.internic.net 2>/dev/null | grep -iq html
+test1=$?
+wget -4 -t 2 -T 7 -O - http://maratona.ime.usp.br 2>/dev/null | grep -iq html
+test2=$?
+wget -4 --no-check-certificate -t 2 -T 7 -O - https://www.wikipedia.org 2>/dev/null | grep -iq html
+test3=$?
+
+if [ "$test1" != "0" -o "$test2" != "0" -o "$test3" != "0" ]; then
+ if [ $debug == 1 ]; then
+ echo "internet problem (1-$test1-$test2-$test3)"
+ fi
+ exit 1
+fi
+
+wget -4 -t 2 -T 7 -O - http://192.0.32.9 2>/dev/null | grep -iq html
+test1=$?
+wget -4 -t 2 -T 7 -O - http://143.107.45.22 2>/dev/null | grep -iq html
+test2=$?
+wget -4 --no-check-certificate -t 2 -T 7 -O - https://91.198.174.192 2>/dev/null | grep -iq html
+test3=$?
+
+if [ "$test1" != "0" -o "$test2" != "0" -o "$test3" != "0" ]; then
+ if [ $debug == 1 ]; then
+ echo "internet problem (2-$test1-$test2-$test3)"
+ fi
+ exit 2
+fi
+exit 0