src.nth.io/

summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLuke Hoersten <[email protected]>2026-07-30 18:19:43 -0500
committerLuke Hoersten <[email protected]>2026-07-30 18:19:43 -0500
commit4d15c92944280312d47198d6861918b3316784bf (patch)
treeee98ca5e4a960874123d7f3405e242c29be766a8
parentf0d085279b2b5310c6f175d01f0d20afdad85e0e (diff)
bitcoind: harden the service unit for boot and shutdown
- order after network-online: rpcbind fails with getaddrinfo errors when bitcoind starts before addresses are configured - restart on failure so a transient bad start heals itself - 30min stop timeout: the chainstate flush can far exceed systemd's 90s default, and a SIGKILL there risks a slow replay or a reindex
-rw-r--r--bitcoind/templates/bitcoind.service.j212
1 files changed, 11 insertions, 1 deletions
diff --git a/bitcoind/templates/bitcoind.service.j2 b/bitcoind/templates/bitcoind.service.j2
index 7c4525a..9106b41 100644
--- a/bitcoind/templates/bitcoind.service.j2
+++ b/bitcoind/templates/bitcoind.service.j2
@@ -1,12 +1,22 @@
[Unit]
Description=bitcoind
-After=network.target
+# network-online (not network): rpcbind to the host address fails with
+# getaddrinfo errors if bitcoind starts before addresses are configured
+Wants=network-online.target
+After=network-online.target
[Service]
ExecStart=/usr/local/bin/bitcoind{% if bitcoind_reindex %} -reindex{% endif %}
User={{bitcoind_user}}
+Restart=on-failure
+RestartSec=30
+
+# chainstate flush on shutdown can far exceed the 90s default; SIGKILL here
+# risks a slow replay or a reindex
+TimeoutStopSec=1800
+
PrivateTmp=true
ProtectSystem=full
NoNewPrivileges=true