Shell script to check whether a server is reachable?
The most barebones check you can do is probably to use netcat to check for open ports. to check for SSH (port 22) reachability, you can do if nc -z $server 22 2>/dev/null; then echo “$server ā” else echo “$server ā” fi from the manpage: -z ā Specifies that nc should just scan for listening … Read more