summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBernard Spil <brnrd@FreeBSD.org>2016-07-24 22:13:02 +0200
committerNirbhay Choubey <nirbhay@mariadb.com>2016-11-21 15:38:33 -0500
commitcf1b0c1ace3584fcd807e0643d30956baa5de2c2 (patch)
treee371a3e59d540460cea6722d101dfda973e4da6a
parentf16ead51fbbf03ca51db9343960785b431fab157 (diff)
downloadmariadb-git-cf1b0c1ace3584fcd807e0643d30956baa5de2c2.tar.gz
Implement native/base process checks for FreeBSD
- Make rsync process checks OS-dependent - Use (BSD) netstat on FreeBSD (not lsof)
-rw-r--r--scripts/wsrep_sst_rsync.sh34
1 files changed, 22 insertions, 12 deletions
diff --git a/scripts/wsrep_sst_rsync.sh b/scripts/wsrep_sst_rsync.sh
index 9b57af53603..b97cd0dd8a3 100644
--- a/scripts/wsrep_sst_rsync.sh
+++ b/scripts/wsrep_sst_rsync.sh
@@ -63,19 +63,29 @@ check_pid_and_port()
local rsync_addr=$3
local rsync_port=$4
- if ! which lsof > /dev/null; then
- wsrep_log_error "lsof tool not found in PATH! Make sure you have it installed."
- exit 2 # ENOENT
- fi
+ case $OS in
+ FreeBSD)
+ local port_info=$(netstat -46lp ${rsync_port} 2>/dev/null | \
+ grep ":${rsync_port}")
+ local is_rsync=$(echo $port_info | \
+ grep -w '[[:space:]]\+rsync[[:space:]]\+'"$rsync_pid" 2>/dev/null)
+ ;;
+ *)
+ if ! which lsof > /dev/null; then
+ wsrep_log_error "lsof tool not found in PATH! Make sure you have it installed."
+ exit 2 # ENOENT
+ fi
- local port_info=$(lsof -i :$rsync_port -Pn 2>/dev/null | \
- grep "(LISTEN)")
- local is_listening_all=$(echo $port_info | \
- grep "*:$rsync_port" 2>/dev/null)
- local is_listening_addr=$(echo $port_info | \
- grep "$rsync_addr:$rsync_port" 2>/dev/null)
- local is_rsync=$(echo $port_info | \
- grep -w '^rsync[[:space:]]\+'"$rsync_pid" 2>/dev/null)
+ local port_info=$(lsof -i :$rsync_port -Pn 2>/dev/null | \
+ grep "(LISTEN)")
+ local is_listening_all=$(echo $port_info | \
+ grep "*:$rsync_port" 2>/dev/null)
+ local is_listening_addr=$(echo $port_info | \
+ grep "$rsync_addr:$rsync_port" 2>/dev/null)
+ local is_rsync=$(echo $port_info | \
+ grep -w '^rsync[[:space:]]\+'"$rsync_pid" 2>/dev/null)
+ ;;
+ esac
if [ ! -z "$is_listening_all" -o ! -z "$is_listening_addr" ]; then
if [ -z "$is_rsync" ]; then