Skip to content

Instantly share code, notes, and snippets.

@chmouel
Created April 6, 2011 10:53
Show Gist options
  • Save chmouel/905467 to your computer and use it in GitHub Desktop.
Save chmouel/905467 to your computer and use it in GitHub Desktop.
Quickly Test if a port is open.. and
python -c 'import socket;s = socket.socket(socket.AF_INET, socket.SOCK_STREAM); s.connect(("localhost", 2022))' >/dev/null 2>/dev/null || blah_launch_server
@chmouel
Copy link
Author

chmouel commented Mar 31, 2016

nc -z -v -w5 localhost 2022

would do as well if you have netcast installed

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment