57 lines
2 KiB
Text
57 lines
2 KiB
Text
|
Index: scripts/wsrep_sst_common.sh
|
||
|
--- scripts/wsrep_sst_common.sh.orig
|
||
|
+++ scripts/wsrep_sst_common.sh
|
||
|
@@ -23,6 +23,11 @@ trap 'exit 3' INT QUIT TERM
|
||
|
# Setting the path for some utilities on CentOS
|
||
|
export PATH="$PATH:/usr/sbin:/usr/bin:/sbin:/bin"
|
||
|
|
||
|
+find()
|
||
|
+{
|
||
|
+ gfind "$@"
|
||
|
+}
|
||
|
+
|
||
|
trim_string()
|
||
|
{
|
||
|
if [ -n "$BASH_VERSION" ]; then
|
||
|
@@ -1166,9 +1171,9 @@ is_local_ip()
|
||
|
# the domain name check:
|
||
|
if [ "${2:-0}" -eq 0 ]; then
|
||
|
# We consider all the names of a given host to be local addresses:
|
||
|
- [ "$1" = "$(hostname -s)" -o \
|
||
|
- "$1" = "$(hostname -f)" -o \
|
||
|
- "$1" = "$(hostname -d)" ] && return 0
|
||
|
+ [ "$1" = "$(hostname -s 2>/dev/null)" -o \
|
||
|
+ "$1" = "$(hostname -f 2>/dev/null)" -o \
|
||
|
+ "$1" = "$(hostname -d 2>/dev/null)" ] && return 0
|
||
|
fi
|
||
|
# If the address contains anything other than digits
|
||
|
# and separators, it is not a local address:
|
||
|
@@ -1199,14 +1204,17 @@ check_sockets_utils()
|
||
|
lsof_available=0
|
||
|
sockstat_available=0
|
||
|
ss_available=0
|
||
|
+ fstat_available=0
|
||
|
|
||
|
[ -n "$(commandex lsof)" ] && lsof_available=1
|
||
|
[ -n "$(commandex sockstat)" ] && sockstat_available=1
|
||
|
[ -n "$(commandex ss)" ] && ss_available=1
|
||
|
+ [ -n "$(commandex fstat)" ] && fstat_available=1
|
||
|
|
||
|
if [ $lsof_available -eq 0 -a \
|
||
|
$sockstat_available -eq 0 -a \
|
||
|
- $ss_available -eq 0 ]
|
||
|
+ $ss_available -eq 0 -a \
|
||
|
+ $fstat_available -eq 0 ]
|
||
|
then
|
||
|
wsrep_log_error "Neither lsof, nor sockstat or ss tool was found in" \
|
||
|
"the PATH. Make sure you have it installed."
|
||
|
@@ -1249,6 +1257,8 @@ check_port()
|
||
|
elif [ $ss_available -ne 0 ]; then
|
||
|
ss -nlpH "( sport = :$port )" 2>/dev/null | \
|
||
|
grep -q -E "users:\\(.*\\(\"($utils)[^[:space:]]*\"[^)]*,pid=$pid(,[^)]*)?\\)" && rc=0
|
||
|
+ elif [ $fstat_available -ne 0 ]; then
|
||
|
+ fstat -n 2>/dev/null | grep -q -E ".*$pid.*:$port\$" && rc=0
|
||
|
else
|
||
|
wsrep_log_error "Unknown sockets utility"
|
||
|
exit 2 # ENOENT
|