aboutsummaryrefslogtreecommitdiff
path: root/tools/boca-checkinternet
blob: 560afef752a559dcb5cb5d9a9fc010b6d3393063 (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
#!/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