ctdb_check_tcp_ports: correctly detect listeners on ipv6 :::<port> w/out netcat
authorMichael Adam <obnox@samba.org>
Fri, 30 Jan 2009 17:14:41 +0000 (18:14 +0100)
committerMichael Adam <obnox@samba.org>
Fri, 30 Jan 2009 21:45:52 +0000 (22:45 +0100)
The netstat test only grepped for the ipv4 wildcard address.
Now the ipv6 wildcard listener is correctly detected as well.

Michael

config/functions

index 826febf15867ebe689637c16ff2ff12c14a322e8..ee48dd256e1b17fc11a2a5ec99b26c715b9de2f0 100644 (file)
@@ -229,7 +229,11 @@ ctdb_check_tcp_ports() {
       if [ "x${NETCAT}" != "x" ]; then
           ${NETCAT} -z 127.0.0.1 $p > /dev/null || all_ok=0
       elif [ "x${NETSTAT}" != "x" ]; then
-          ( ${NETSTAT} -a -n | egrep "0.0.0.0:$p .*LISTEN" > /dev/null ) || all_ok=0
+          if ! ${NETSTAT} -a -n | egrep "0.0.0.0:$p .*LISTEN" > /dev/null ; then
+              if ! ${NETSTAT} -a -n | egrep ":::$p .*LISTEN" > /dev/null ; then
+                  all_ok=0
+              fi
+          fi
       else
           echo "ERROR: neither netcat (or nc) nor netstat found!"
           echo "ERROR: can't monitor ${service_name} tcp port ${p}"