Skip to content

Instantly share code, notes, and snippets.

@DasFranck
Created June 23, 2018 21:51
Show Gist options
  • Save DasFranck/8ac7e55d76e8d060ae3734065c84c04d to your computer and use it in GitHub Desktop.
Save DasFranck/8ac7e55d76e8d060ae3734065c84c04d to your computer and use it in GitHub Desktop.
Minecraft server's systemd files
[Unit]
Description=Minecraft Server
[Service]
WorkingDirectory=/home/minecraft/server/
User=minecraft
Type=forking
ExecStart=/usr/bin/tmux new-session -s mcserver -d './run.sh'
ExecStop=/usr/bin/tmux send-keys -t mcserver:0.0 'say SERVER SHUTTING DOWN. Saving map...' C-m 'save-all' C-m 'stop' C-m
ExecStop=/bin/sleep 3
[Install]
WantedBy=multi-user.target
java -Xmx7G -jar forge*.jar nogui
@DasFranck
Copy link
Author

minecraft.service -> /etc/systemd/system/minecraft.service
run.sh -> /home/minecraft/server/run.sh

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment