From 009a4aabe0a06a913cf6c905acbbffbbf3c5d049 Mon Sep 17 00:00:00 2001 From: Enrico Da Ros Date: Thu, 5 Nov 2020 08:49:40 +0000 Subject: [PATCH] Updated with suggestions --- dev/n_osync.sh | 10 +++++++++- dev/ofunctions.sh | 2 +- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/dev/n_osync.sh b/dev/n_osync.sh index 912e01e..dd275ed 100644 --- a/dev/n_osync.sh +++ b/dev/n_osync.sh @@ -512,9 +512,17 @@ function _HandleLocksRemote { CheckConnectivity3rdPartyHosts CheckConnectivityRemoteHost + + # Check if -A exists on target + ps -A > /dev/null 2>&1 + notExistaCapitalA=$? # Create an array of all currently running pids - read -a initiatorRunningPids <<< $(ps -a | tail -n +2 | awk '{print $1}') + if [ "$notExistaCapitalA" == "1"]; then + read -a initiatorRunningPids <<< $(ps -e | tail -n +2 | awk '{print $1}') + else + read -a initiatorRunningPids <<< $(ps -A | tail -n +2 | awk '{print $1}') + fi # passing initiatorRunningPids as litteral string (has to be run through eval to be an array again) $SSH_CMD env _REMOTE_TOKEN="$_REMOTE_TOKEN" \ diff --git a/dev/ofunctions.sh b/dev/ofunctions.sh index 0179116..5b2cfea 100644 --- a/dev/ofunctions.sh +++ b/dev/ofunctions.sh @@ -767,7 +767,7 @@ function _PerfProfiler { #__WITH_PARANOIA_DEBUG perfString=$(ps -p $$ -o args,pid,ppid,%cpu,%mem,time,etime,state,wchan) #__WITH_PARANOIA_DEBUG #__WITH_PARANOIA_DEBUG for i in $(pgrep -P $$); do #__WITH_PARANOIA_DEBUG - perfString="$perfString\n"$(ps -p $i -o args,pid,ppid,%cpu,%mem,time,etime,state,wchan | tail -1) #__WITH_PARANOIA_DEBUG + perfString="$perfString\n"$(ps -p $i -o args,pid,ppid,%cpu,%mem,time,etime,state,wchan | :| tail -1) #__WITH_PARANOIA_DEBUG done #__WITH_PARANOIA_DEBUG #__WITH_PARANOIA_DEBUG if type iostat > /dev/null 2>&1; then #__WITH_PARANOIA_DEBUG