epugh commented on code in PR #1951:
URL: https://github.com/apache/solr/pull/1951#discussion_r1335003023


##########
solr/bin/solr:
##########
@@ -739,36 +718,31 @@ function stop_solr() {
   STOP_KEY="$3"
   SOLR_PID="$4"
 
-  if [ -n "$SOLR_PID"  ]; then
-    echo -e "Sending stop command to Solr running on port $SOLR_PORT ... 
waiting up to $SOLR_STOP_WAIT seconds to allow Jetty process $SOLR_PID to stop 
gracefully."
-    # shellcheck disable=SC2086
-    "$JAVA" $SOLR_SSL_OPTS $AUTHC_OPTS ${SOLR_TOOL_OPTS:-} -jar 
"$DIR/start.jar" "STOP.PORT=$THIS_STOP_PORT" "STOP.KEY=$STOP_KEY" --stop || true
-      (loops=0
-      while true
-      do
-        # Check if a process is running with the specified PID.
-        # -o stat will output the STAT, where Z indicates a zombie
-        # stat='' removes the header (--no-headers isn't supported on all 
platforms)
-        # Note the space after '$('. It is needed to avoid confusion with 
special bash eval syntax
-        STAT=$( (ps -o stat='' -p "$SOLR_PID" || :) | tr -d ' ')
-        if [[ "${STAT:-Z}" != "Z" ]]; then
-          slept=$((loops * 2))
-          if [ $slept -lt $SOLR_STOP_WAIT ]; then
-            sleep 2
-            loops=$((loops+1))
-          else
-            exit # subshell!
-          fi
+  echo -e "Sending stop command to Solr running on port $SOLR_PORT ... waiting 
up to $SOLR_STOP_WAIT seconds to allow Jetty process $SOLR_PID to stop 
gracefully."
+  # shellcheck disable=SC2086
+  "$JAVA" $SOLR_SSL_OPTS $AUTHC_OPTS ${SOLR_TOOL_OPTS:-} -jar "$DIR/start.jar" 
"STOP.PORT=$THIS_STOP_PORT" "STOP.KEY=$STOP_KEY" --stop || true
+    (loops=0
+    while true
+    do
+      # Check if a process is running with the specified PID.
+      # -o stat will output the STAT, where Z indicates a zombie
+      # stat='' removes the header (--no-headers isn't supported on all 
platforms)
+      # Note the space after '$('. It is needed to avoid confusion with 
special bash eval syntax

Review Comment:
   An this is why I ❤️  bash..   ;-).



##########
solr/bin/solr:
##########
@@ -739,36 +718,31 @@ function stop_solr() {
   STOP_KEY="$3"
   SOLR_PID="$4"
 
-  if [ -n "$SOLR_PID"  ]; then
-    echo -e "Sending stop command to Solr running on port $SOLR_PORT ... 
waiting up to $SOLR_STOP_WAIT seconds to allow Jetty process $SOLR_PID to stop 
gracefully."
-    # shellcheck disable=SC2086
-    "$JAVA" $SOLR_SSL_OPTS $AUTHC_OPTS ${SOLR_TOOL_OPTS:-} -jar 
"$DIR/start.jar" "STOP.PORT=$THIS_STOP_PORT" "STOP.KEY=$STOP_KEY" --stop || true
-      (loops=0
-      while true
-      do
-        # Check if a process is running with the specified PID.
-        # -o stat will output the STAT, where Z indicates a zombie
-        # stat='' removes the header (--no-headers isn't supported on all 
platforms)
-        # Note the space after '$('. It is needed to avoid confusion with 
special bash eval syntax
-        STAT=$( (ps -o stat='' -p "$SOLR_PID" || :) | tr -d ' ')
-        if [[ "${STAT:-Z}" != "Z" ]]; then
-          slept=$((loops * 2))
-          if [ $slept -lt $SOLR_STOP_WAIT ]; then
-            sleep 2
-            loops=$((loops+1))
-          else
-            exit # subshell!
-          fi
+  echo -e "Sending stop command to Solr running on port $SOLR_PORT ... waiting 
up to $SOLR_STOP_WAIT seconds to allow Jetty process $SOLR_PID to stop 
gracefully."
+  # shellcheck disable=SC2086
+  "$JAVA" $SOLR_SSL_OPTS $AUTHC_OPTS ${SOLR_TOOL_OPTS:-} -jar "$DIR/start.jar" 
"STOP.PORT=$THIS_STOP_PORT" "STOP.KEY=$STOP_KEY" --stop || true
+    (loops=0
+    while true
+    do
+      # Check if a process is running with the specified PID.
+      # -o stat will output the STAT, where Z indicates a zombie
+      # stat='' removes the header (--no-headers isn't supported on all 
platforms)
+      # Note the space after '$('. It is needed to avoid confusion with 
special bash eval syntax

Review Comment:
   An this is why I ❤️  bash..   ;-).



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to