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)?
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. It only takes a minute to sign up.Sign up to join this community
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.