aboutsummaryrefslogtreecommitdiffstats
path: root/clients/admintool.sh
blob: 889dd19d7c236e7fb0faa99a71336b411ed655f1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
while :; do
        (
                for i in $( cut -d" " -f1 pingswitches.txt ); do
			ADMINADDR=$( echo $i | perl -pi -le '@x = split /\./; $x[3] += 2; $_ = join(".", @x);' )
                        ( (
                                if ping -c2 -W3 -q $ADMINADDR >/dev/null; then
                                        grep $i pingswitches.txt | sed 's/^/PONGER: /'
                                else
                                        grep $i pingswitches.txt | sed 's/^/PONGER IKKE: /'
                                fi
                        ) & )
                done
        ) > pong.new
	while pidof ping > /dev/null; do sleep 1; done
        mv pong.new pong
        echo "sleeping"
        sleep 10
done