Skip to content

Commit 5cd096a

Browse files
committed
textproc/apache-solr: use sockstat instead of lsof
While starting solr it is using now sockstat and can detect now if the start was successful. The patch is also provided upstream here: apache/solr#2906 Thanks a lot [email protected] to provide with the required sockstat parameters to make this PR possible. PR: 283270 (cherry picked from commit a164dd2)
1 parent 7a72770 commit 5cd096a

File tree

2 files changed

+34
-0
lines changed

2 files changed

+34
-0
lines changed

textproc/apache-solr/Makefile

+1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
PORTNAME= apache-solr
22
PORTVERSION= 9.7.0
3+
PORTREVISION= 1
34
PORTEPOCH= 1
45
CATEGORIES= textproc java
56
MASTER_SITES= https://archive.apache.org/dist/solr/solr/${PORTVERSION}/
+33
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
--- bin/solr.orig 2024-08-06 17:02:34 UTC
2+
+++ bin/solr
3+
@@ -2027,13 +2027,20 @@ function start_solr() {
4+
fi
5+
6+
# no lsof on cygwin though
7+
+ check_command=""
8+
if lsof -v 2>&1 | grep -q revision; then
9+
+ check_command="lsof -t -PniTCP:$SOLR_PORT -sTCP:LISTEN"
10+
+ elif which -s sockstat; then
11+
+ check_command="sockstat -q46lp$SOLR_PORT"
12+
+ fi
13+
+
14+
+ if [[ "${check_command}" != "" ]]; then
15+
echo -n "Waiting up to $SOLR_START_WAIT seconds to see Solr running on port $SOLR_PORT"
16+
# Launch in a subshell to show the spinner
17+
(loops=0
18+
while true
19+
do
20+
- running=$(lsof -t -PniTCP:$SOLR_PORT -sTCP:LISTEN || :)
21+
+ running=$(${check_command} || :)
22+
if [ -z "${running:-}" ]; then
23+
slept=$((loops * 2))
24+
if [ $slept -lt $SOLR_START_WAIT ]; then
25+
@@ -2052,7 +2059,7 @@ function start_solr() {
26+
done) &
27+
spinner $!
28+
else
29+
- echo -e "NOTE: Please install lsof as this script needs it to determine if Solr is listening on port $SOLR_PORT."
30+
+ echo -e "NOTE: Please install lsof or sockstat as this script needs it to determine if Solr is listening on port $SOLR_PORT."
31+
sleep 10
32+
SOLR_PID=$(ps auxww | grep start\.jar | awk "/\-Djetty\.port=$SOLR_PORT/"' {print $2}' | sort -r)
33+
echo -e "\nStarted Solr server on port $SOLR_PORT (pid=$SOLR_PID). Happy searching!\n"

0 commit comments

Comments
 (0)