blob: fc00b1f92e4cfe2bc2307c8c6314a6a0c5ac3982 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
|
#!/usr/bin/env bash
set -euo pipefail
RPC_PORT="${MONZERO_RPC_PORT:-16175}"
RPC_URL="http://127.0.0.1:$RPC_PORT"
response="$(curl --silent --show-error --fail --max-time 10 \
--header 'Content-Type: application/json' \
--data '{}' "$RPC_URL/stop_mining")"
python3 - "$response" <<'PY'
import json
import sys
data = json.loads(sys.argv[1])
status = data.get("status", "")
if status != "OK":
raise SystemExit(f"Unable to stop mining: {data.get('error_details') or status or data}")
print("Mining stopped. The daemon remains running.")
PY
|