I would like to run a bash command when a remote connection is successfully established to a specified local open port. I have looked into netcat and socat, but I'm not sure if either have the functionality that I want. I do not care about the content of the communication, only that a connection has been established (the connection can be immediately dropped after starting).
This is because, I have a local resource (a Minecraft server) that I want to start only when requested. In theory, a client should attempt a connection (which will of course fail, initially), the server will then start, and after a few moments the client can connect once more to a running server.