Check All Users System for UP or DOWN by Ping
#!/bin/bash
#
# Check All Users System for UP or DOWN by Ping and generate a report.
#
set $(date)
#### Users system status report file path ####
FP=/root/Desktop/ping_status_$3-$2-$6.txt
#### Remove the old file ####
/usr/bin/find /root/Desktop/ping_status_$3-$2-$6.txt -mtime -1 -exec /bin/rm -f {} \;
#### File Info ####
echo "$3-$2-$6 Developers System Ping Status" >> $FP
echo " " >> $FP
#1
#### User1 ####
/bin/ping -c 2 192.168.30.5 &> /dev/null
if [ $? = 0 ];
then echo "User1's System is UP" >> $FP
else echo "User1's System is DOWN" >> $FP
fi
echo " " >> $FP
#2
#### User2 ####
/bin/ping -c 2 192.168.30.21 &> /dev/null
if [ $? = 0 ];
then echo "User2's System is UP" >> $FP
else echo "User2's System is DOWN" >> $FP
fi
echo " " >> $FP
#3
#### User3 ####
/bin/ping -c 2 192.168.30.18 &> /dev/null
if [ $? = 0 ];
then echo "User3's System is UP" >> $FP
else echo "User3's System is DOWN" >> $FP
fi
echo " " >> $FP
#4
#### User4 ####
/bin/ping -c 2 192.168.30.14 &> /dev/null
if [ $? = 0 ];
then echo "User4's System is UP" >> $FP
else echo "User4's System is DOWN" >> $FP
fi
echo " " >> $FP
#5
#### User5 ####
/bin/ping -c 2 192.168.30.26 &> /dev/null
if [ $? = 0 ];
then echo "User5's System is UP" >> $FP
else echo "User5's System is DOWN" >> $FP
fi
echo " " >> $FP
#6
#### User6 ####
/bin/ping -c 2 192.168.30.15 &> /dev/null
if [ $? = 0 ];
then echo "User6's System is UP" >> $FP
else echo "User6's System is DOWN" >> $FP
fi
echo " " >> $FP
#7
#### User7 ####
/bin/ping -c 2 192.168.30.25 &> /dev/null
if [ $? = 0 ];
then echo "User7's System is UP" >> $FP
else echo "User7's System is DOWN" >> $FP
fi
echo " " >> $FP
#8
#### User8 ####
/bin/ping -c 2 192.168.30.12 &> /dev/null
if [ $? = 0 ];
then echo "User8's System is UP" >> $FP
else echo "User8's System is DOWN" >> $FP
fi
echo " " >> $FP
#9
#### User9 ####
/bin/ping -c 2 192.168.30.40 &> /dev/null
if [ $? = 0 ];
then echo "User9's System is UP" >> $FP
else echo "User9's System is DOWN" >> $FP
fi
echo " " >> $FP
#10
#### User10 ####
/bin/ping -c 2 192.168.30.11 &> /dev/null
if [ $? = 0 ];
then echo "User10's System is UP" >> $FP
else echo "User10's System is DOWN" >> $FP
fi
echo " " >> $FP