Checking multiple hosts available through the network in once on Linux

I have been using this small script to check if multiple host would have been online.

#!/bin/bash

for host in 192.168.1.{120,41};
do
ping -c 1 “$host” > /dev/null

if [ “$?” -eq 0 ] ; then
echo $host “Hosts up”
else
echo $host “Host down”
fi
done

Leave a Reply