SOLR-6529: fix regression in error handling introduced by using pid files for finding Solr processes on the localhost

git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/trunk@1631514 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Timothy Potter 2014-10-13 19:23:22 +00:00
parent 9322323d8b
commit fe41822918
1 changed files with 23 additions and 2 deletions

View File

@ -285,7 +285,23 @@ function get_info() {
fi fi
done done
else else
echo -e "\nNo Solr nodes are running.\n" # no pid files but check using ps just to be sure
numSolrs=`ps waux | grep java | grep start.jar | wc -l | sed -e 's/^[ \t]*//'`
if [ "$numSolrs" != "0" ]; then
echo -e "\nFound $numSolrs Solr nodes: "
for ID in `ps waux | grep java | grep start.jar | awk '{print $2}' | sort -r`
do
port=`jetty_port "$ID"`
if [ "$port" != "" ]; then
echo ""
echo "Found Solr process $ID running on port $port"
run_tool status -solr http://localhost:$port/solr
echo ""
fi
done
else
echo -e "\nNo Solr nodes are running.\n"
fi
fi fi
} # end get_info } # end get_info
@ -711,9 +727,14 @@ if [[ "$SCRIPT_CMD" == "start" ]]; then
fi fi
else else
# either stop or restart # either stop or restart
# see if Solr is already running
SOLR_PID=`solr_pid_by_port "$SOLR_PORT"` SOLR_PID=`solr_pid_by_port "$SOLR_PORT"`
if [ "$SOLR_PID" == "" ]; then
# not found using the pid file ... but use ps to ensure not found
SOLR_PID=`ps waux | grep start.jar | grep $SOLR_PORT | grep -v grep | awk '{print $2}' | sort -r`
fi
if [ "$SOLR_PID" != "" ]; then if [ "$SOLR_PID" != "" ]; then
stop_solr "$SOLR_SERVER_DIR" "$SOLR_PORT" "$STOP_KEY" "$SOLR_PID" stop_solr "$SOLR_SERVER_DIR" "$SOLR_PORT" "$STOP_KEY" "$SOLR_PID"
else else
echo -e "No process found for Solr node running on port $SOLR_PORT" echo -e "No process found for Solr node running on port $SOLR_PORT"
fi fi