Skip to content

Systemd unit example

pgbv edited this page Jul 22, 2024 · 1 revision
[Unit]
Requires=docker.service
Requires=network-online.target

[Service]
ExecStartPre=-/usr/bin/docker stop --time 30 nfkserver1
ExecStartPre=-/usr/bin/docker rm --force nfkserver1
ExecStart=/usr/bin/docker run --rm \
 -p 29991:29991/udp \
 -p 28991:28991/tcp \
 -e NFK_HOSTNAME="Example docker server" \
 -e PORT=29991 \
 -e RCON_PASSWORD="secretpass" \
 -e MAP="tdm1 tdm" \
 -e DEMO_AUTORECORD_ENABLE=1 \
 -e DEMO_SEND_ENABLE=1 \
 -e DEMO_STORE_ENABLE=0 \
 -e MAXPLAYERS=4 \
 --name=nfkserver1 \
 -v /opt/nfk-maps:/srv/server/maps:ro \
 local/nfk-dedicated:latest
ExecStop=-/usr/bin/docker stop --time 30 nfkserver1
Restart=always
StartLimitInterval=0
RestartSec=10

[Install]
WantedBy=multi-user.target
Clone this wiki locally