Created
November 21, 2023 12:05
-
-
Save Taurolyon/15a65e077edfa5267c94ad68213b7519 to your computer and use it in GitHub Desktop.
systemd daemon service file for minecraft dedicated server
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[Unit] | |
Description=Minecraft dedicated server | |
Wants=network-online.target | |
After=syslog.target network.target nss-lookup.target network-online.target | |
[Service] | |
ExecStartPre=/home/minecraft/mcserver/update_server.sh | |
ExecStart=/home/minecraft/mcserver/launch.sh | |
User=minecraft | |
Group=minecraft | |
StandardOutput=journal | |
Restart=on-failure | |
WorkingDirectory=/home/minecraft/mcserver | |
[Install] | |
WantedBy=multi-user.target |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
See also: https://gist.github.com/Taurolyon/b0e833a210488b0572e752119aaccdcd
This has the script for the
update_server.sh
script used inExecStartPre
launch.sh
inExecStart
only contains the following:I wasn't sure about using the
ExecStart=/usr/bin/java [...] -jar server.jar [...]
if it would respectWorkingDirectory=/home/minecraft/mcserver
Perhaps I'll experiment later.
Follow-up
Passed check using:
systemd-analyze verify minecraft.service
Follow up with
systemctl daemon-reload
and enable with
systemctl enable --now minecraft.service
(make sure game server isn't already running in a user-instance such as GNU screen)
systemctl status minecraft.service