Skip to content

Commit

Permalink
Fix port retrieval in torq.sh summary (#554)
Browse files Browse the repository at this point in the history
  • Loading branch information
jonathonmcmurray authored Apr 26, 2023
1 parent 573f67a commit dd50638
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions torq.sh
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ parameter() {

findproc() {
procno=$(awk '/,'$1',/{print NR}' "$CSVPATH") # get line number for file
pgrep -f "\-stackid ${KDBBASEPORT} \-proctype $(getfield "$procno" proctype) \-procname $1" # get pid of process
pgrep -f "\-stackid ${KDBBASEPORT} \-proctype $(getfield "$procno" proctype) \-procname $1 " # get pid of process
}

startline() {
Expand Down Expand Up @@ -132,7 +132,7 @@ summary() {
printf "%s | %s | down |" "$(date '+%H:%M:%S')" "$1" # summary table row for down process
else
pid=$((findproc "$1")|awk 'END{print}')
port=$(echo $(netstat -nlp 2>/dev/null | grep -w "$pid" | awk '{ print $4 }' | awk -F: '{ print $2 }')) # get port process is running on
port=$(echo $(netstat -nlp 2>/dev/null | grep " $pid/" | awk '{ print $4 }' | awk -F: '{ print $2 }')) # get port process is running on
printf "%s | %s | up | %s | %s" "$(date '+%H:%M:%S')" "$1" "$pid" "$port" # summary table row for running process
fi
fi
Expand Down

0 comments on commit dd50638

Please sign in to comment.