Add a new command 'ctdb checktcpport <port>'
authorRonnie Sahlberg <ronniesahlberg@gmail.com>
Wed, 17 Aug 2011 00:16:35 +0000 (10:16 +1000)
committerRonnie Sahlberg <ronniesahlberg@gmail.com>
Wed, 17 Aug 2011 00:16:35 +0000 (10:16 +1000)
commitd84c171a9ca18f9fe1f71a3fd329e77a012a1481
tree628ac6653147e4984de3b0174234866feba769e8
parentd1ab5d6cd17b71ebc737790f543820bb820b56fd
Add a new command 'ctdb checktcpport <port>'
that tries to bind to the specified port on INADDR_ANY.

This can be used for testing if a service is listening to that port or not.

Errors are printed to stdout and the returned status code is either 0 : if we managed to bind to the port (in which case the service is NOT listening on that bort) or the value of errno that stopped us from binding to a port.

errno for EADDRINUSE is 98 so a script using this command should check the status code against the value 98.
If this command returns 98 it means the service is listening to the specified port.
tools/ctdb.c