#!/bin/bash
cat server.txt | while read line
do
        # check for no blank lines
        if [ ! -z $line ]; then
                PINGCOUNT=2
                PING=$(ping -c $PINGCOUNT $line | grep received | cut -d ',' -f2 | cut -d ' ' -f2)
                if [ $PING -eq 0 ]; then
echo "DOWN $line" | mail -s DOWN  
test@test.com                else
echo "UP $line" 
fi
        fi
done