RHEL-7 doesn't install netstat by default. The minimal install has
`ss' so use it instead. As RHEL-5 doesn't have ss in iproute packge
keep using netstat as a fallback.
Check for aviability of both tools, abort if none is available.
Signed-off-by: Hubert Kario <hkario(a)redhat.com>
---
Fixes RHBZ#1208586 and RHBZ#1205330
src/synchronisation.sh | 14 +++++++++++++-
1 file changed, 13 insertions(+), 1 deletion(-)
diff --git a/src/synchronisation.sh b/src/synchronisation.sh
index 2b6121a..d28e155 100644
--- a/src/synchronisation.sh
+++ b/src/synchronisation.sh
@@ -471,7 +471,19 @@ rlWaitForSocket(){
;;
esac
- local cmd="netstat -nl | grep -E '$grep_opt' >/dev/null"
+ local ss_path=$(env which ss 2>/dev/null)
+ if [[ $? -eq 0 ]] && [[ -n $ss_path ]]; then
+ # FIXME, should also have sctp, but it is not yet supported by ss
+ local tool="$ss_path -l -n -o -A tcp,udp,unix"
+ else
+ local tool="$(env which netstat 2>/dev/null) -nl"
+ if [[ $? -ne 0 ]]; then
+ rlLogError "rlWaitForSocket: Can't find \`netstat' or \`ss'
in system, aborting"
+ return 127
+ fi
+ fi
+
+ local cmd="$tool | grep -E '$grep_opt' >/dev/null"
if [[ ${close:-false} == true ]]; then
rlLogInfo "rlWaitForSocket: Waiting max ${timeout}s for socket
\`$socket' to close"
--
1.9.3
Show replies by date