Minecraft Backup

This script is a simple script that will backup by the date, that way, you can put a cron job together that will backup your Minecraft server on a nightly basis.  As my scripting skills are basic, it works, but I’m always open to hearing better methods


—-Start Script—-



mkdir -p /usr/backups/minecraft/$(date +%d_%m_%Y)

cd /usr/backups/minecraft

cp -R /usr/local/www/minecraft_server /usr/backups/minecraft/$(date +%d_%m_%Y)

tar czf $(date +%d_%m_%Y).tar.gz $(date +%d_%m_%Y)

rm -R $(date +%d_%m_%Y)


—-End Script—–


Now that backup will run as root, but you can always demote the script from root (I have a  noshell user called minecraft24, then chown the folder in step 1) as there is no reason anything Minecraft should run as root.  That backup script will create subfolders that will be named by the date, backup, tar, and clean itself up so you have a nice backup.  Now, you’ll need a crontab…


—Start Crontab—-





30 23 * * * /usr/backups/


—-End Crontab—-


So my crontab runs everyday at 11:30pm Local time… There’s nothing special going on here, but for someone that is new to crontabs and making simple backups, this should be helpful.