Alternative to ping [closed] Alternative to ping [closed] unix unix

Alternative to ping [closed]


I think curl is exactly what you want. Like all well-behaved unix programs, it returns an error code if anything goes wrong:

[cnicutar@ariel ~]$ curl www.no-such-website.com[cnicutar@ariel ~]$ echo $?6

Also you may want to use --connect-timeout to make sure it doesn't wait forever.


CURL won't work as a quick check if the server is up and the web server daemon is down. One alternative is to send a TCP ACK with tools like hping3. If you get a RST, the server is UP.

hping3 -c 1 -V -p 80 -s 5050 -A example.fqdn

What you could do is try the CURL test first and on failure try the second method to confirm that the server is down and not just the web server daemon.

The problem with this method is that a stray TCP packet like this could be filtered by an intermediate proxy.


If you can ssh to it then it's up. A simple way of checking this with nc is:nc -zv 111.222.333.444 22(Replace 111.222.333.444 with the ip address of your instance)