[PATCH] synchronisation.sh: fix man section for rlWait
by Hubert Kario
Signed-off-by: Hubert Kario <hkario(a)redhat.com>
---
src/synchronisation.sh | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/synchronisation.sh b/src/synchronisation.sh
index 2b6121a..d5b52b4 100644
--- a/src/synchronisation.sh
+++ b/src/synchronisation.sh
@@ -493,7 +493,7 @@ rlWaitForSocket(){
Wrapper around bash builtin `wait' command. See bash_builtins(1) man page.
Kills the process and all its children if the timeout elapses.
- rlWaitFor [n ...] [-s SIGNAL] [-t time]
+ rlWait [n ...] [-s SIGNAL] [-t time]
=over
--
1.9.3
9 years
[PATCH] rlWaitForSocket - use ss, fallback to netstat
by Hubert Kario
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
9 years