igneum/packaging/mac/app/Stop Igneum Miner.command

18 lines
897 B
Bash
Executable file

#!/bin/bash
# Stops a running Igneum Miner: asks the engine to quit through its local API (miner first, then the node), waits,
# then ends whatever is left from the app bundle. 0.3.0, 4 October 2026.
URL_FILE="$HOME/Library/Application Support/Igneum/app/app.url"
if [ -f "$URL_FILE" ]; then
url="$(cat "$URL_FILE")"
if curl -s -m 5 -X POST "${url}api/quit" -d '{}' >/dev/null 2>&1; then
echo "asked Igneum Miner to stop (miner first, then the node)"
for i in $(seq 1 50); do pgrep -f 'Igneum Miner.app/Contents/' >/dev/null || break; sleep 1; done
fi
fi
left="$(pgrep -f 'Igneum Miner.app/Contents/' 2>/dev/null)"
if [ -n "$left" ]; then
echo "ending leftover processes: $(echo $left | tr '\n' ' ')"
pkill -TERM -f 'Igneum Miner.app/Contents/' 2>/dev/null; sleep 5
pkill -KILL -f 'Igneum Miner.app/Contents/' 2>/dev/null
fi
echo "Igneum Miner is stopped."