Преглед на файлове

explorerd: improve process termination in 'stop' makefile target

This commit enhances the process termination mechanism in the 'stop' target by:
- Adding a check to verify that a PID is running before attempting to terminate it
- Implementing a more graceful termination approach by first sending SIGTERM (15) and only using SIGKILL (9) as a fallback
kalm преди 1 година
родител
ревизия
c4e22941d9
променени са 1 файла, в които са добавени 3 реда и са изтрити 2 реда
  1. 3 2
      bin/explorer/explorerd/Makefile

+ 3 - 2
bin/explorer/explorerd/Makefile

@@ -138,10 +138,11 @@ check-minerd:
 stop:
 	@if [ -f PIDs.txt ]; then \
 		while read PID; do \
-			kill $$PID 2>/dev/null || echo "Unable to kill PID $$PID"; \
+			if ps -p $$PID > /dev/null 2>&1; then \
+				kill -15 $$PID 2>/dev/null; sleep 5; ps -p $$PID > /dev/null 2>&1 && kill -9 $$PID 2>/dev/null; \
+			fi; \
 		done < PIDs.txt; \
 		rm -f PIDs.txt; \
-		sleep 5; \
 		echo "Stopped explorer node environment"; \
 	else \
 		if [ "$(suppress_not_running)" != "1" ]; then \