Files
pubsub/util/nats-server.service
Phil Pennock 4f93ebf265 systemd: switch to Restart=on-failure
I switched the hardened example config file to use `Restart=always` in
6c22217f4 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.
2025-04-30 16:46:51 -04:00

26 lines
611 B
Desktop File

[Unit]
Description=NATS Server
After=network-online.target ntp.service
[Service]
PrivateTmp=true
Type=simple
ExecStart=/usr/sbin/nats-server -c /etc/nats-server.conf
ExecReload=/bin/kill -s HUP $MAINPID
# The nats-server uses SIGUSR2 to trigger Lame Duck Mode (LDM) shutdown
# https://docs.nats.io/running-a-nats-service/nats_admin/lame_duck_mode
ExecStop=/bin/kill -s SIGUSR2 $MAINPID
# This should be `lame_duck_duration` + some buffer to finish the shutdown.
# By default, `lame_duck_duration` is 2 mins.
TimeoutStopSec=150
Restart=on-failure
User=nats
Group=nats
[Install]
WantedBy=multi-user.target