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
This commit is contained in:
kalm
2025-03-12 23:11:02 -07:00
parent bec2f5c55e
commit c4e22941d9

View File

@@ -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 \