First, make sure your Minecraft server and VPS is activated and that your Minecraft server is OFFLINE. Having your Minecraft server offline when running this type of backup will ensure that your backup data won't be incomplete/corrupt when it is downloaded to the backup server.
Ensure that your VPS has CentOS 6 64-bit installed.
Now login to your Multicraft control panel for your Minecraft server to obtain your FTP login information by going to https://mc.beastnode.com then going to the Files > FTP File Access page. Once you have that information, you can now work on the VPS side of things.
1. Login to your VPS via SSH by following this guide: https://www.beastnode.com/portal/knowledgebase/91/How-to-Login-to-Your-VPS.html
2. Once logged in, install the following:
yum install wget rsync -y
3. Now navigate to your desired backup location. We'll be using /backups in this example:
4. Now, fill in the following code with your FTP information from your BeastNode Minecraft server (the "-X /plugins/dynmap" part tells it to ignore that directory as Dynmap files will take extremely long to download to a point where the backup may never finish in a reasonable amount of time - if you don't have Dynmap, this part of the code is still fine to use)
wget -X /plugins/dynmap -r ftp://USERNAME:PASSWORD@FTP_IP_HERE
Note: If your username contains an email, replace the @ symbol with %40 in the username part of the script as follows for example:
wget -X /plugins/dynmap -r ftp://user%40gmail.com:password@FTP_IP_HERE
5. Create a test directory and navigate to it:
6. Now test that completed wget command you created in step 4 by pasting it and hitting enter. The download of all your server files should start. If it does, you can either let it complete or cancel it by pressing ctrl+c
At this point, you are basically done and can create folders for each time you run this backup script manually. If you wish to automate it, you can continue on!
Automating the Backup Process
We'll be using a cron job to automate the above backup process so that you don't have to always check on it. Please do keep an eye on your disk space usage on the VPS though and keep in mind that running a backup like this while your server is online could result in a bit of lag and may also result in incomplete backup data (since it might download data while your Minecraft server is updating it).
1. Create the backup script:
2. Once in the vi editor, hit "i" on your keyboard to enable editing and paste the following (make sure to fill in the wget code as in the previous steps above):
/usr/bin/wget -X /plugins/dynmap -r ftp://USERNAME:PASSWORD@FTP_IP_HERE
3. Save the file and exit the editor by pressing the ESC key on your keyboard then typing the following and hit enter:
4. Make the file executable:
chmod 755 backup.sh
5. Open the cron job editor:
6. Press "i" on your keyboard and enter the following:
0 0 * * * /backups/backup.sh
The above line will run the backup script every day at midnight (server time). If you want to change the day/time, you can refer to this page for more about cron format: http://www.nncron.ru/help/EN/working/cron-format.htm
7. Save and exit the cron editor by hitting ESC on your keyboard then typing :x
You're all done! Now every day at midnight, your VPS will download your server files into the /backups directory. Each backup will be put into a folder named by the date (year-month-day).
At this point, it is highly recommended that you secure your SSH login on the VPS by installing a program like Fail2Ban, which blocks IPs of those who try to brute force your server: https://www.beastnode.com/portal/knowledgebase/142/Protect-SSH-with-Fail2Ban-on-CentOS-6.html
This method can take a very long time to complete the backup if your server has a lot of data (especially if you have a plugin like Dynmap installed or a large world). As a result, it may be beneficial for you to space out your backups in time periods of more than 24 hours by changing the cron time (otherwise it might start another backup before the previous one could complete).
For example, if you want it run every 3 days at midnight, you can set your cron script as follows:
0 0 */3 * * /backups/backup.sh