Linux

Starting your server automatically with systemd

Turn your game server or bot into a service: it starts when the VPS boots, comes back if it crashes and its logs are kept.

1 min readUpdated on 6 October 2026

A systemd service is the proper way to keep something running on Linux: it starts by itself after a reboot, comes back if it crashes and logs everything it writes. The example is a Minecraft server, but it works for anything.

1. A user for the server

Better not to run it as root: if someone breaks in through the game, they do not get the whole machine.

adduser --disabled-password --gecos "" minecraft
# copy your server to /home/minecraft/server and set ownership:
chown -R minecraft:minecraft /home/minecraft/server

2. The service file

Create /etc/systemd/system/minecraft.service:

[Unit]
Description=Minecraft server
After=network-online.target
Wants=network-online.target

[Service]
User=minecraft
WorkingDirectory=/home/minecraft/server
ExecStart=/usr/bin/java -Xms4G -Xmx4G -jar paper.jar --nogui
Restart=on-failure
RestartSec=10

[Install]
WantedBy=multi-user.target

Change WorkingDirectory and ExecStart to your server's folder and command. Always use full paths (which java shows Java's).

3. Enable it

systemctl daemon-reload
systemctl enable --now minecraft

enable makes it start with the VPS; --now starts it right away.

Day to day

systemctl status minecraft      # is it running?
systemctl restart minecraft     # restart it
systemctl stop minecraft        # stop it
journalctl -u minecraft -f      # watch its console live (Ctrl + C to exit)

What about the game console?

As a service you cannot type into its console directly. Manage it with RCON (Minecraft, Rust, ARK and Palworld have it) or with in-game admin commands. On systemctl stop, Minecraft saves the world before closing.

If you would rather keep a console at hand and do not mind starting it yourself after each reboot, screen or tmux may suit you better.

Related articles

Back to the help centre

Can’t find what you need?

Open a ticket from your panel and we will answer in under 5 minutes.