Skip to content

Commit 32c2e4f

Browse files
committed
Make relay daemon recovery optional-aware
1 parent 8346d4d commit 32c2e4f

1 file changed

Lines changed: 21 additions & 10 deletions

File tree

fix_daemon.sh

Lines changed: 21 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,10 @@ usage() {
1515
Usage: fix_daemon.sh [--dry-run] <reason> [options]
1616
1717
Reasons:
18-
xmr-lag restart monerod and xtm_mm
19-
proxy-unhealthy restart monerod and xtm_mm
20-
xtm-lag restart local xtm if present/enabled and xtm_mm
21-
template-stuck restart monerod, local xtm if present/enabled, and xtm_mm
18+
xmr-lag restart monerod, relay-pool if present, and xtm_mm if present
19+
proxy-unhealthy restart monerod, relay-pool if present, and xtm_mm if present
20+
xtm-lag restart local xtm if present/enabled, relay-pool if present, and xtm_mm if present
21+
template-stuck restart monerod, local xtm if present/enabled, relay-pool if present, and xtm_mm if present
2222
2323
Options:
2424
--port <port>
@@ -141,6 +141,14 @@ run_optional_service() {
141141
fi
142142
}
143143

144+
restart_relay_pool() {
145+
run_optional_service restart relay-pool.service
146+
}
147+
148+
run_xtm_mm_service() {
149+
run_optional_service "$1" xtm_mm.service
150+
}
151+
144152
wait_json_rpc() {
145153
local name="$1"
146154
local url="$2"
@@ -201,28 +209,31 @@ log "starting $reason recovery$(describe_context)"
201209

202210
case "$reason" in
203211
xmr-lag|proxy-unhealthy)
204-
run_service stop xtm_mm.service || true
212+
run_xtm_mm_service stop || true
205213
run_service restart monero.service
214+
restart_relay_pool
206215
wait_monero_rpc || true
207-
run_service start xtm_mm.service
216+
run_xtm_mm_service start
208217
;;
209218
xtm-lag)
210-
run_service stop xtm_mm.service || true
219+
run_xtm_mm_service stop || true
211220
run_optional_service restart xtm.service
221+
restart_relay_pool
212222
if service_exists xtm.service || [ "$dry_run" -eq 1 ]; then
213223
wait_tari_rpc || true
214224
fi
215-
run_service start xtm_mm.service
225+
run_xtm_mm_service start
216226
;;
217227
template-stuck|unknown|*)
218-
run_service stop xtm_mm.service || true
228+
run_xtm_mm_service stop || true
219229
run_service restart monero.service
220230
run_optional_service restart xtm.service
231+
restart_relay_pool
221232
wait_monero_rpc || true
222233
if service_exists xtm.service || [ "$dry_run" -eq 1 ]; then
223234
wait_tari_rpc || true
224235
fi
225-
run_service start xtm_mm.service
236+
run_xtm_mm_service start
226237
;;
227238
esac
228239

0 commit comments

Comments
 (0)