Skip to content

Commit c4e2294

Browse files
author
kalm
committed
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
1 parent bec2f5c commit c4e2294

1 file changed

Lines changed: 3 additions & 2 deletions

File tree

bin/explorer/explorerd/Makefile

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -138,10 +138,11 @@ check-minerd:
138138
stop:
139139
@if [ -f PIDs.txt ]; then \
140140
while read PID; do \
141-
kill $$PID 2>/dev/null || echo "Unable to kill PID $$PID"; \
141+
if ps -p $$PID > /dev/null 2>&1; then \
142+
kill -15 $$PID 2>/dev/null; sleep 5; ps -p $$PID > /dev/null 2>&1 && kill -9 $$PID 2>/dev/null; \
143+
fi; \
142144
done < PIDs.txt; \
143145
rm -f PIDs.txt; \
144-
sleep 5; \
145146
echo "Stopped explorer node environment"; \
146147
else \
147148
if [ "$(suppress_not_running)" != "1" ]; then \

0 commit comments

Comments
 (0)