summarylogtreecommitdiffstats
path: root/project-zomboid-server.service
diff options
context:
space:
mode:
authorKyle Brady2021-12-31 18:48:12 -0800
committerKyle Brady2022-01-03 23:33:53 -0800
commitc1ea0cdee4733e0a00d721dc1000d2e5411f9cda (patch)
treedda77c353be1da02ba19adf371a39c6b45883a7c /project-zomboid-server.service
downloadaur-c1ea0cdee4733e0a00d721dc1000d2e5411f9cda.tar.gz
Inital package creation (41.65)
Diffstat (limited to 'project-zomboid-server.service')
-rw-r--r--project-zomboid-server.service38
1 files changed, 38 insertions, 0 deletions
diff --git a/project-zomboid-server.service b/project-zomboid-server.service
new file mode 100644
index 000000000000..f988e14058f0
--- /dev/null
+++ b/project-zomboid-server.service
@@ -0,0 +1,38 @@
+[Unit]
+Description=Project Zomboid dedicated server
+
+[Service]
+Type=simple
+User=zomboid
+Group=zomboid
+
+Environment=LD_LIBRARY_PATH="/opt/project-zomboid-server/linux64:/opt/project-zomboid-server/natives:/opt/project-zomboid-server/:${LD_LIBRARY_PATH}"
+EnvironmentFile=/etc/project-zomboid/server.conf
+# These variables need to be changed from the default value in the EnvironmentFile
+ExecCondition=/usr/bin/test "${ADMIN_PASSWORD}" != "CHANGE_ME"
+ExecCondition=/usr/bin/test "${RCON_PASSWORD}" != "CHANGE_ME"
+ExecStart=/opt/project-zomboid-server/ProjectZomboid64 $JVM_ARGS -- -adminpassword "${ADMIN_PASSWORD}" -servername "${NAME}" $SERVER_ARGS
+ExecStop=/usr/bin/rcon -a "127.0.0.1:${RCON_PORT}" -p "${RCON_PASSWORD}" -t rcon quit
+# Quitting / saving is aysnc, and doesn't have a good way to be wrapped by systemd
+# use timeout + tail to try and give the process some time to exit
+ExecStop=/usr/bin/timeout 60s /usr/bin/tail --pid="${MAINPID}" -f /dev/null
+ExecReload=/usr/bin/rcon -a "127.0.0.1:${RCON_PORT}" -p "${RCON_PASSWORD}" -t rcon reloadoptions
+
+WorkingDirectory=/opt/project-zomboid-server
+ReadWritePaths=/opt/project-zomboid-server
+ProtectSystem=full
+ProtectHome=true
+PrivateTmp=yes
+PrivateDevices=yes
+ProtectClock=yes
+ProtectKernelTunables=yes
+ProtectKernelModules=yes
+ProtectKernelLogs=yes
+ProtectControlGroups=yes
+RestrictSUIDSGID=yes
+RestrictRealtime=yes
+RestrictNamespaces=yes
+NoNewPrivileges=yes
+
+[Install]
+WantedBy=multi-user.target