Created
October 30, 2014 20:51
-
-
Save SamRothCA/1537bf368e9a13b7aa5f to your computer and use it in GitHub Desktop.
Test if a server is online
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ping -c1 -t3 example.com &> /dev/null |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
If the server in question is behind a modem our router or something (like most home servers), this will only tell you if the router/modem is online. Netcat would normally be more ideal, like this:
This checks to see if there is anything listening in port 22 (standard SSH port) on the server you're testing. It will wait up to 3 seconds per attempt before it times out, and it will make 5 total attempts.