systemd: switch to Restart=on-failure

I switched the hardened example config file to use `Restart=always` in
c78874276 just over a year ago.  That was a mistake.

If the nats-server is asked to shut down, and shuts down cleanly, then the
service manager should not restart it.  The server should be restarted if it
exits on failure.
This commit is contained in:
Phil Pennock
2025-04-30 16:46:51 -04:00
parent 707f953ff4
commit 9f2d4aec16
2 changed files with 3 additions and 1 deletions
+1 -1
View File
@@ -19,7 +19,7 @@ ExecStop=/bin/kill -s SIGUSR2 $MAINPID
User=nats
Group=nats
Restart=always
Restart=on-failure
RestartSec=5
# This should be `lame_duck_duration` + some buffer to finish the shutdown.
+2
View File
@@ -16,6 +16,8 @@ ExecStop=/bin/kill -s SIGUSR2 $MAINPID
# By default, `lame_duck_duration` is 2 mins.
TimeoutStopSec=150
Restart=on-failure
User=nats
Group=nats