Sample Ping Script


It’s just a simple ping script.

#!/bin/bash
# Program name: test.sh
date
cat /root/listping.txt | while read output
do
ping -c 1 "$output" > /dev/null
if [ $? -eq 0 ]; then
echo "node $output is up"
else
echo "node $output is down"
fi
done