Bash- loop until a connection is successful

Date: 2015-02-16 Tags: linux, bash

I use Terminator as my terminal app, and use the “watch for activity” feature a lot. With the following command, I’d get notified as soon as the connection is opened.

while ! nc -vz localhost 3306 2> /dev/null; do sleep 1; done && echo "Available!"



Thanks for reading this post!


Did you find an issue in this article?

- click on the following Github link
- log into Github with your account
- click on the line number containing the error
- click on the "..." button
- choose "Reference in new issue"
- add a title and your comment
- click "Submit new issue"

Your feedback is much appreciated! πŸ€œπŸΌπŸ€›πŸΌ

You can also drop me a line below!