The point is obvious. There is more than one way to burn a book. And the world is full of people running about with lit matches. Every minority ... feels it has the will, the right, the duty to douse the kerosene, light the fuse. Every dimwit editor who sees himself as the source of all dreary blanc-mange plain porridge unleavened literature, licks his guillotine and eyes the neck of any author who dares to speak above a whisper or write above a nursery rhyme.”
~Ray Bradbury

pingcheck.sh

Google+ Pinterest LinkedIn Tumblr +

This little program takes something like the following as infile.txt and pings each endpoint to find the nearest one. Format is:

        <linename> [space]<ipaddress>

(though if you just feed it a list of IP’s, that’ll work too)

paddr1 162.242.211.137

ipaddr2 78.46.223.24

ipaddr3 50.116.40.226

ipaddr4 50.116.23.211

ipaddr5 37.235.1.174

ipaddr6 37.235.1.177

ipaddr7 84.200.69.80

ipaddr8 84.200.70.40

ipaddr9 91.239.100.100

ipaddr10 89.233.43.71

pingcheck.sh
#!/bin/bash
# $1 - source header/label, $2 - IPAddr/hostname
infile=infile.txt
logfile=pingcheck.log

rm $logfile
count=1
cat $infile | while read lineitem; do
        label=$(echo "$lineitem" | awk '{ print $1 }')
        ipaddr=$(echo "$lineitem" | cut -d " " -f2)
        echo -n "$label: " | tee -a $logfile
        ping -c 2 -q $ipaddr | grep "rtt" | cut -d "/" -f5 | tee -a $logfile
        echo " " | tee -a $logfile
done
Share.

Leave A Reply

Secured By miniOrange