summaryrefslogtreecommitdiff
path: root/textproc/apache-solr/files/patch-bin_solr
blob: 9184b2f8ba456830113d664bd8d5a15892cad7ec (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
--- bin/solr.orig	2024-08-06 17:02:34 UTC
+++ bin/solr
@@ -2027,13 +2027,20 @@ function start_solr() {
     fi
 
     # no lsof on cygwin though
+    check_command=""
     if lsof -v 2>&1 | grep -q revision; then
+      check_command="lsof -t -PniTCP:$SOLR_PORT -sTCP:LISTEN"
+    elif which -s sockstat; then
+      check_command="sockstat -q46lp$SOLR_PORT"
+    fi
+    
+    if [[ "${check_command}" != "" ]]; then
       echo -n "Waiting up to $SOLR_START_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 -t -PniTCP:$SOLR_PORT -sTCP:LISTEN || :)
+        running=$(${check_command} || :)
         if [ -z "${running:-}" ]; then
           slept=$((loops * 2))
           if [ $slept -lt $SOLR_START_WAIT ]; then
@@ -2052,7 +2059,7 @@ function start_solr() {
       done) &
       spinner $!
     else
-      echo -e "NOTE: Please install lsof as this script needs it to determine if Solr is listening on port $SOLR_PORT."
+      echo -e "NOTE: Please install lsof or sockstat as this script needs it to determine if Solr is listening on port $SOLR_PORT."
       sleep 10
       SOLR_PID=$(ps auxww | grep start\.jar | awk "/\-Djetty\.port=$SOLR_PORT/"' {print $2}' | sort -r)
       echo -e "\nStarted Solr server on port $SOLR_PORT (pid=$SOLR_PID). Happy searching!\n"