Quickly check hosts with ping

I needed a script for a quick health check of a bunch of servers. This is how I did it using the ping command: for((i=1;i<42;i++)); do ping -c 1 -W 3 host${i}.domain.com &> /dev/null if [ $? -ne 0 ] ; then echo “host${i} is down” else echo “host${i} is up” fi done You can …