Posts

Showing posts with the label Ping

Bash Ping Script File For Checking Host Availability

Answer : I would use this, a simple one-liner: while ! ping -c1 HOSTNAME &>/dev/null; do echo "Ping Fail - `date`"; done ; echo "Host Found - `date`" ; /root/scripts/test1.sh Replace HOSTNAME with the host you are trying to ping. I missed the part about putting it in the background, put that line in a shellscript like so: #!/bin/sh while ! ping -c1 $1 &>/dev/null do echo "Ping Fail - `date`" done echo "Host Found - `date`" /root/scripts/test1.sh And to background it you would run it like so: nohup ./networktest.sh HOSTNAME > /tmp/networktest.out 2>&1 & Again replace HOSTNAME with the host you are trying to ping. In this approach you are passing the hostname as an argument to the shellscript. Just as a general warning, if your host stays down, you will have this script continuously pinging in the background until you either kill it or the host is found. So I would keep that in mind when y...

Can Ping IP Address And Nslookup Hostname But Cannot Ping Hostname Temporarily In Windows

Answer : I faced the same problem in my network. When you use this command: ping icecream It uses WINS server since you have used icecream not icecream.my.domain . When looking for such words, Windows looks for NETBIOS names, but when you look for complete domain records, it will look in the DNS server. You can use one of the solutions below: Make sure you have correct records for that station in your WINS server. Use the complete domain name instead of using the host file. E.g. icecream.my.domain You don't have DNS suffixes configured. Either configure them, or use FQDN like this and it should work: ping icecream.my.domain