Clovertech
› Clovertech Forums › Read Only Archives › Cloverleaf › Cloverleaf › ping mutiple IPs at once AIX script
Do anyone out there have shell script to ping mutiple hostname/ IPs? Thank in advance
#!/bin/sh ping host1 ping host2
Sorry, I couldn’t resist.
I can’t resist either. Try this so it doesn’t ping forever:
#!/bin/sh ping -c count host1 ping -c count host2
Cheers.
After all it is Friday… 8)
#!/bin/ksh HOST1=$(ping -c 5 host1 | grep “bytes from” | wc -l) HOST2=$(ping -c 5 host2 | grep “bytes from” | wc -l) [[ $HOST1 -eq 5 ]] && [[$HOST2 -eq 5]] && echo “All OK” && exit 0 echo “Some Connection Failure” exit 1
Robert Milfajt Northwestern Medicine Chicago, IL