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:20:19 +0000 (10:20 +1000)
commit04cbb490c5a075080923fde58af7082572c55c43
treea8001e0d2c5af3a68e5e2321747d41007d0af3ec
parent82628e32c431d66b806399ffb9657c3a031f6428
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