Backup Our Minecraft Server using rsync and cron

Home / Linux / Backup Our Minecraft Server using rsync and cron
Backup Our Minecraft Server using rsync and cron

Now that we’ve setup our Craftbukkit/Minecraft Virtual machine to mount our box.com account into a folder in our user directory, it’s time to configure a simple script and cron job to sync our server to the cloud.

First, let’s make and new bash script named boxsync to run the rsync process:

minecraft@mcserver:~$ nano boxsync

We are using these lines in this script because we want the script to sync the bukkitserver folder from our user directory to our box.com account.

#!/bin/bash
rsync -avr –delete /home/minecraft/bukkitserver/ /home/minecraft/box.com/bukkitserver

Now make that file executable to the owner:

minecraft@mcserver:~$ chmod u+x boxsync

Now I’m going to schedule a cron job to automatically run this bashscript:

crontab -e will get us into the editor for our cron jobs.

Putting this line at the end of our crontab file will setup our cron job to run the script on the zero minute of midnight and noon every day , (the first zero is the minutes field, “0,12” in the hours field and the asterisks being all for the Days, Months and Weekdays fields):

0 0,12 * * * /home/minecraft/boxsync

That’s it.  Our RSYNC schedule is complete and will keep a twice-daily synchronized backup of our Craftbukkit/Minecraft server on our box.com account.

One thought on “Backup Our Minecraft Server using rsync and cron

Comments are closed.