# using the "ctdb checktcpport" command.
ctdb_check_tcp_ports()
{
- if [ -z "$1" ] ; then
- echo "INTERNAL ERROR: ctdb_check_tcp_ports - no ports specified"
- exit 1
- fi
-
- for _p ; do # process each function argument (port)
- _cmd="$CTDB checktcpport $_p"
- _out=$($_cmd 2>&1)
- _ret=$?
- case "$_ret" in
- 0)
- _ctdb_check_tcp_common
- if [ ! -f "$_ctdb_service_started_file" ] ; then
- echo "ERROR: $service_name tcp port $_p is not responding"
- debug "\"ctdb checktcpport $_p\" was able to bind to port"
- else
- echo "INFO: $service_name tcp port $_p is not responding"
- fi
+ if [ -z "$1" ] ; then
+ echo "INTERNAL ERROR: ctdb_check_tcp_ports - no ports specified"
+ exit 1
+ fi
- return 1
- ;;
- 98)
- # Couldn't bind, something already listening, next port...
- continue
- ;;
- *)
- echo "ERROR: unexpected error running \"ctdb checktcpport\""
- debug <<EOF
-$CTDB checktcpport (exited with $_ret) with output:
-$_out"
-EOF
- return $_ret
- esac
- done
+ for _p ; do # process each function argument (port)
+ _cmd="$CTDB checktcpport $_p"
+ _out=$($_cmd 2>&1)
+ _ret=$?
+ case "$_ret" in
+ 0)
+ echo "$service_name not listening on TCP port $_p"
+ return 1
+ ;;
+ 98)
+ # Couldn't bind, something already listening, next port
+ continue
+ ;;
+ *)
+ echo "unexpected error (${_ret}) running \"${_cmd}\""
+ if [ -n "$_out" ] ; then
+ echo "$_out"
+ fi
+ return $_ret
+ ;;
+ esac
+ done
- # All ports listening
- _ctdb_check_tcp_common
- rm -f "$_ctdb_service_started_file"
- return 0
+ # All ports listening
+ return 0
}
######################################################
{
_out=$("$@" 2>&1) || {
echo "ERROR: $* returned error"
- echo "$_out" | debug
+ if [ -n "$_out" ] ; then
+ debug "$_out"
+ fi
exit 1
}
}
export CTDB_MANAGES_VSFTPD="yes"
ok <<EOF
-ERROR: vsftpd tcp port 21 is not responding
+vsftpd not listening on TCP port 21
WARNING: vsftpd not listening but less than 2 consecutive failures, not unhealthy yet
EOF
simple_test
required_result 1 <<EOF
-ERROR: vsftpd tcp port 21 is not responding
+vsftpd not listening on TCP port 21
ERROR: 2 consecutive failures for vsftpd, marking node unhealthy
EOF
simple_test
+++ /dev/null
-#!/bin/sh
-
-. "${TEST_SCRIPTS_DIR}/unit.sh"
-
-define_test "port 139 down, default tcp checker, debug"
-
-export CTDB_SCRIPT_DEBUGLEVEL=DEBUG
-
-setup_samba
-tcp_port_down 139
-
-required_result 1 <<EOF
-ERROR: samba tcp port 139 is not responding
-DEBUG: "ctdb checktcpport 139" was able to bind to port
-EOF
-
-simple_test