summaryrefslogtreecommitdiff
path: root/ctdb/config
diff options
context:
space:
mode:
authorMartin Schwenke <martin@meltin.net>2017-03-18 21:53:06 +1100
committerMartin Schwenke <martins@samba.org>2017-09-12 12:23:19 +0200
commitff635f90edd8e012ac2838303cb0285ab09b8db6 (patch)
treeb11743190c8644481f08712bbb75b981d8cfb782 /ctdb/config
parentbff8d410f93a0e50d16aff4896bea2d48e46f33a (diff)
downloadsamba-ff635f90edd8e012ac2838303cb0285ab09b8db6.tar.gz
ctdb-scripts: Clean up ctdb_check_unix_socket()
Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Amitay Isaacs <amitay@gmail.com>
Diffstat (limited to 'ctdb/config')
-rwxr-xr-xctdb/config/functions21
1 files changed, 13 insertions, 8 deletions
diff --git a/ctdb/config/functions b/ctdb/config/functions
index 1131229ebb9..e31a095ab27 100755
--- a/ctdb/config/functions
+++ b/ctdb/config/functions
@@ -376,16 +376,21 @@ ctdb_check_tcp_ports()
######################################################
# check a unix socket
-# usage: ctdb_check_unix_socket SERVICE_NAME <socket_path>
+# usage: ctdb_check_unix_socket SOCKPATH
######################################################
-ctdb_check_unix_socket() {
- socket_path="$1"
- [ -z "$socket_path" ] && return
+ctdb_check_unix_socket()
+{
+ _sockpath="$1"
- if ! netstat --unix -a -n | grep -q "^unix.*LISTEN.*${socket_path}$"; then
- echo "ERROR: $service_name socket $socket_path not found"
- return 1
- fi
+ if [ -z "$_sockpath" ] ; then
+ echo "ERROR: ctdb_check_unix_socket() requires socket path"
+ return 1
+ fi
+
+ if ! netstat --unix -a -n | grep -q "^unix.*LISTEN.*${_sockpath}$"; then
+ echo "ERROR: ${service_name} not listening on ${_sockpath}"
+ return 1
+ fi
}
################################################