Ubuntu/Centos
This is one that has been stuck in my junk folder for a little while but it does the job and is fairly light weight:
The script requires LFTP
On ubuntu LFTP can be installed easily with the following command:
Your phone or window isn't wide enough to display the code box. If it's a phone, try rotating it to landscape mode.
- Code: Select all
sudo apt-get install -y lftp
On Centos LFTP can be installed easily with the following Command:
Your phone or window isn't wide enough to display the code box. If it's a phone, try rotating it to landscape mode.
- Code: Select all
sudo yum install -y lftp
Below is the script used, Ensure you update the following information(and the dir. locations if needed) in the script:
<LOCAL_USERNAME> <FTP_HOSTNAME_OR_IP> <FTP_USERNAME> <FTP_PASSWORD>
Your phone or window isn't wide enough to display the code box. If it's a phone, try rotating it to landscape mode.
- Code: Select all
#!/bin/bash
#title :mtbackup.sh
#description :This script backup your minetest world to a ftp location of your choice and will keep 7 days worth of daily backup's.
#author :Ryan Nolan[crazyR]
#date :20160419
#version :1.0-public
#usage :mtbackup.sh
#notes :Install lftp to use this script.
#==============================================================================
BACKUP_DAY=`/bin/date '+%a'`
BACKUP_HOST="<FTP_HOSTNAME_OR_IP>"
BACKUP_PORT="21"
BACKUP_USER="<FTP_USERNAME>"
BACKUP_PASS="<FTP_PASSWORD>"
WORLD_DIR="/home/<LOCAL_USERNAME>/.minetest/worlds/world"
LOCAL_DIR="/home/<LOCAL_USERNAME>/backups"
REMOTE_DIR="/"
#### Do not edit below this line
######################################################
mkdir -p $LOCAL_DIR
if [ -d "$LOCAL_DIR" ]; then
tar -cvzf $LOCAL_DIR/backup_$DAY.tar.gz $MINETEST_DIR/
lftp -c "set ftp:list-options -a;
open 'ftp://$BACKUP_USER:$BACKUP_PASS@$BACKUP_HOST:$BACKUP_PORT';
lcd $LOCAL_DIR;
cd $REMOTE_DIR;
mirror --reverse \
--verbose"
fi
The full file can be found on Gist here: https://gist.github.com/Ryan-Nolan/66f52e8ab0f7b1480b286e2f1208245d
Windows OS's
I’m currently waiting on a friend to provide me with a batch script to do pretty much the same as above.
But one way I have done things in the past is to create a Mapped drive to (s)ftp then use a batch script to copy the contents of your world folder to the mapped drive.
Other OS's
Please post any other ideas below for other OS's and ill update this list.
Note
This above is not the necessarily best solution its always best to do backups over SFTP but some people don’t have that facility available to them. I will update the post with SFTP based scripts soon too.
Please don’t be commenting with insults, if you have a better way of doing the above while still keeping it simple for amateurs then post your suggestions and ill update the scripts where applicable.
Let’s make this thread useful.
Thanks, Regards
crazyR