| 1 |
[Unit] |
| 2 |
Description=NATS Server |
| 3 |
After=network-online.target ntp.service |
| 4 |
|
| 5 |
[Service] |
| 6 |
PrivateTmp=true |
| 7 |
Type=simple |
| 8 |
ExecStart=/usr/sbin/nats-server -c /etc/nats-server.conf |
| 9 |
ExecReload=/bin/kill -s HUP $MAINPID |
| 10 |
|
| 11 |
# The nats-server uses SIGUSR2 to trigger Lame Duck Mode (LDM) shutdown |
| 12 |
# https://docs.nats.io/running-a-nats-service/nats_admin/lame_duck_mode |
| 13 |
ExecStop=/bin/kill -s SIGUSR2 $MAINPID |
| 14 |
|
| 15 |
# This should be `lame_duck_duration` + some buffer to finish the shutdown. |
| 16 |
# By default, `lame_duck_duration` is 2 mins. |
| 17 |
TimeoutStopSec=150 |
| 18 |
|
| 19 |
Restart=on-failure |
| 20 |
|
| 21 |
User=nats |
| 22 |
Group=nats |
| 23 |
|
| 24 |
[Install] |
| 25 |
WantedBy=multi-user.target |