From fc51637f6e998402d058b98b2394900c6b0e5ea8 Mon Sep 17 00:00:00 2001 From: Zachary Brown Date: Wed, 13 Dec 2023 10:38:36 -0800 Subject: [PATCH] build: auto-restart with systemd --- build-scripts/deb/climate-tokenization-engine@.service | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/build-scripts/deb/climate-tokenization-engine@.service b/build-scripts/deb/climate-tokenization-engine@.service index 11f1089..8c5f78f 100644 --- a/build-scripts/deb/climate-tokenization-engine@.service +++ b/build-scripts/deb/climate-tokenization-engine@.service @@ -19,6 +19,10 @@ [Unit] Description=Climate Tokenization Engine +# Stop automatically restarting if 10 failures in 5 minutes +StartLimitIntervalSec=300 +StartLimitBurst=10 + [Service] # Set Chia directory as an environment variable Environment=CHIA_ROOT=/home/%i/.chia/mainnet @@ -30,5 +34,9 @@ ExecStart=/opt/climate-tokenization-engine/climate-tokenization-engine User=%i Group=%i +# Auto-restart if process stopped outside of systemd +Restart=on-failure +RestartSec=10s + [Install] WantedBy=multi-user.target