Waiting for server to accept SSH connections

Sometimes you need to wait for a just booted server to accept SSH connections. This can be solved with a one-line bash script:

until nc -w 10 -z $SERVER_IP 22; do echo "SSH not available" && sleep 5; done


This entry was posted in Debian, Ubuntu. Bookmark the permalink.