A small collection (for now) of things I use on my minecraft server.
backup.sh
A pretty simple script to backup your entire LINUX Minecraft Server directory to another directory of your choice. It can also auto-update to the latest version of Paper (github.com/PaperMC/Paper) after 'x' number of days. It has some error checking, logs everything it does, auto-deletes old backups after 'x' days and has the ability to alert using Pushover (www.pushover.net).minecraft-server.service
- A Linux service file to run your PaperMC server in a screen session
See a list of To Do's on the wiki page here https://github.com/badbread/breadsMCstuff/wiki.
Hopefully you'll find this script of some use, this all started when my personal server crashed and I lost everything. It started on a windows machine with a batch file backup job to a NAS, then to powershell script because I didn't like .bat logging, and now to a full blown ESXi VM with nightly backups and automated updates.
This script is based on my server which uses the following:
- Linux server (Debian 9 or Ubuntu) already running a PaperMC server
- Server running via a service: minecraft-server.server
- Server running in Linux screen
- Permissions to start/stop the service without a password prompt (lookup sudoers)
"username" ALL=NOPASSWD:/usr/sbin/service "service file name" start
"username" ALL=NOPASSWD:/usr/sbin/service "service file name" stop
minecraft ALL=NOPASSWD:/usr/sbin/service minecraft-server stop
minecraft ALL=NOPASSWD:/usr/sbin/service minecraft-server start
- (Temporary) A pushover account from pushover.net (hoping to remove this Dependency soon), in the meantime you can comment out any "push" code in there
A few variables must match exactly in your service file and the backup.sh script.
- If your service file name is "minecraft-server.service" then the servicename variable in the backup.sh script will be
servicename="minecraft-server"
- In your service file, the name of the screen in this command for example
ExecStart=/usr/bin/screen -h 2048 -dmS SCREENNAME java
must match the screenname variable in the backup.sh script. Using this as an example your backup.sh script screenname variable will bescreenname=SCREENNAME
- source = the directory to be backed up (ex: /somedir/minecraft)
- dest = where the archive files will be placed (ex: /mnt/someNASdevice/minecraftbackup)
- savemethod = 'y' or 'n'
- This determines if the script will send a stop-save command (the 'y' option) to the server or a stop (the 'n' option) to the server
- Note if you want the server to auto upgrade this variable must be set to 'n'
- If you plan on using the automatic update part, create a directory in your source folder called .jarbackups
mkdir .jarbackups/
- This is a hidden folder the old paperclip.jar files live in for x (30 by default) days before being automatically deleted
- daystokeep = how many days to keep backup files in the $dest (default "+7")
- Note that the + sign needs to be in front, same goes for the variables below except "tries"
- paperclipupdateinterval = how many days old the paperclip.jar file needs to be before it's updated (default is "+5")
- paperclipjartime = how many days to keep the old replaced paperclip.jar files in the .jarbackups folder before deleting them (default is +30)
- tries = this probably isn't needed anymore, description in script.
- log_file = what the logfile is called and where it's stored (default $dest"log.txt")
- autoupdate = if you want your paperclip.jar file to automatically update after paperclipupdateinterval days
- log = do you want to log all results to the $dest dir (default is "y")
- pushtoken = Your pushover API key
- pushuser = Your pushover user key
- pushsubject = Subject of the push (Minecraft server alert)
- BASH
Please read CONTRIBUTING.md for details on our code of conduct, and the process for submitting pull requests to us.
- badbread - Initial work - badbread
This project is licensed under the MIT License - see the LICENSE.md file for details