This is for Ubuntu 18.04 / Systemd
Install deps
sudo apt-get install -y screen wget rdiff-backup openjdk-11-jre-headless
Create a minecraft service user
sudo adduser --system --group --disabled-password --shell /bin/bash minecraft
Switch to the minecraft user and switch to their home dir
sudo su minecraft
cd
Make the minecraft server dir in minecraft's home dir and cd into it
mkdir minecraft_server && cd $_
Download the minecraft server jar from https://minecraft.net/en-us/download/server/
wget https://launcher.mojang.com/v1/objects/ThisLinkIsOutdated/server.jar
Accept the eula by running echo 'eula=true' > eula.txt
Copy all the service_* scripts into the minecraft_server dir and
chmod u+x service_*.
Copy the do_backups.sh to one directory up, the minecraft user's home dir.
chmod it too: chmod u+x do_backups.sh.
And then create a cron job to run backups as frequently as you'd like, I'd suggest every hour:
crontab -e
0 * * * * /home/minecraft/do_backups.sh
exit the minecraft user and back to your regular user.
Install the minecraft_screen.sh script to your home dir and
chmod u+x minecraft_screen.sh.
Install the service /etc/systemd/system/minecraft.service.
Reload for the new service: sudo systemctl daemon-reload
Start it sudo systemctl start minecraft.
Ensure it's running sudo systemctl status minecraft.
Set it to start on boot sudo systemctl enable minecraft.
You're done.
Thanks for these scripts.