From ac777a5352224b2c8f46836f0e078809308fc2d8 Mon Sep 17 00:00:00 2001 From: Martijn Koster Date: Mon, 6 Jan 2020 13:20:14 +0100 Subject: [PATCH] SOLR-13089: Fix lsof edge cases in the solr CLI script --- solr/CHANGES.txt | 2 ++ solr/bin/solr | 4 ++-- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/solr/CHANGES.txt b/solr/CHANGES.txt index 44cec922161..73067e09af1 100644 --- a/solr/CHANGES.txt +++ b/solr/CHANGES.txt @@ -212,6 +212,8 @@ Bug Fixes * SOLR-14122: SimUtils converts v2 to v1 request params incorrectly. (Li Cao, ab) +* SOLR-13089: Fix lsof edge cases in the solr CLI script (Martijn Koster via janhoy) + Other Changes --------------------- diff --git a/solr/bin/solr b/solr/bin/solr index 580f344e664..b3ffecf0a6e 100755 --- a/solr/bin/solr +++ b/solr/bin/solr @@ -2241,13 +2241,13 @@ function start_solr() { echo "" fi # no lsof on cygwin though - if hash lsof 2>/dev/null ; then # hash returns true if lsof is on the path + if lsof -v 2>&1 | grep -q revision; then echo -n "Waiting up to $SOLR_STOP_WAIT seconds to see Solr running on port $SOLR_PORT" # Launch in a subshell to show the spinner (loops=0 while true do - running=`lsof -PniTCP:$SOLR_PORT -sTCP:LISTEN` + running=$(lsof -t -PniTCP:$SOLR_PORT -sTCP:LISTEN) if [ -z "$running" ]; then slept=$((loops * 2)) if [ $slept -lt $SOLR_STOP_WAIT ]; then