I want to delay the script execution until a certain server process is ready, which it is once it accepts incoming TCP connections.

How do I test if a local TCP port is open (I get a SYN/ACK answer)?


I would use lsof if available for this purpose. You can grep the output to check for a line of output with a LISTEN condition for the port in question. Some options may have to be passed to prevent converting port names to symbolic, etc, see man lsof for details.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.