diff options
author | Martin Schwenke <martin@meltin.net> | 2017-03-18 21:53:06 +1100 |
---|---|---|
committer | Martin Schwenke <martins@samba.org> | 2017-09-12 12:23:19 +0200 |
commit | ff635f90edd8e012ac2838303cb0285ab09b8db6 (patch) | |
tree | b11743190c8644481f08712bbb75b981d8cfb782 /ctdb/config | |
parent | bff8d410f93a0e50d16aff4896bea2d48e46f33a (diff) | |
download | samba-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-x | ctdb/config/functions | 21 |
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 } ################################################ |