initial update backupscript to use with simple leveldb database
This commit is contained in:
parent
bf77eb6e5a
commit
2d91c64e32
57
backup.sh
57
backup.sh
@ -2,6 +2,7 @@
|
|||||||
# Illuna Minetest Backup
|
# Illuna Minetest Backup
|
||||||
#
|
#
|
||||||
set -e
|
set -e
|
||||||
|
user=illuna
|
||||||
|
|
||||||
# the backupscript of the Illuna Minetest Universe.
|
# the backupscript of the Illuna Minetest Universe.
|
||||||
# this may only be interesting for you when you use
|
# this may only be interesting for you when you use
|
||||||
@ -25,15 +26,10 @@ world1=vip-world
|
|||||||
world2=ctf
|
world2=ctf
|
||||||
world3=techeth
|
world3=techeth
|
||||||
|
|
||||||
|
world3Minetest=illuna-techeth-minetestserver
|
||||||
|
world3Database=illuna-techeth-mtredisalize
|
||||||
|
|
||||||
backupdir='/home/illuna/backups'
|
backupdir='/home/illuna/backups'
|
||||||
#sftpdir='/ftp/illuna/'
|
|
||||||
# location of the ssdb dumptool
|
|
||||||
#
|
|
||||||
dumptool='/usr/local/ssdb/ssdb-dump'
|
|
||||||
ip='127.0.0.1'
|
|
||||||
port1='8888'
|
|
||||||
#port2='8889'
|
|
||||||
port3='8890'
|
|
||||||
|
|
||||||
date=`date '+%y%m%d%H%M'`
|
date=`date '+%y%m%d%H%M'`
|
||||||
tmp=$backupdir/$date
|
tmp=$backupdir/$date
|
||||||
@ -49,38 +45,35 @@ backupfile=$backupdir/${date}.tar.gz
|
|||||||
#####################################################################
|
#####################################################################
|
||||||
|
|
||||||
echo "create our working directory"
|
echo "create our working directory"
|
||||||
#
|
su - $user -c "mkdir -p $tmp"
|
||||||
mkdir -p $tmp
|
|
||||||
|
|
||||||
echo "sync all the stuff to the tmp directory"
|
echo "sync all the stuff to the tmp directory"
|
||||||
# excluding rollback as this is not relevant
|
# excluding rollback as this is not relevant
|
||||||
# when restoring from backup and only takes
|
# when restoring from backup and only takes
|
||||||
# bunch of space.
|
# bunch of space.
|
||||||
#
|
#
|
||||||
ionice -c3 rsync -arptg --temp-dir=/var/tmp/rsync $configdir $worldsdir/$world2 $worldsdir/$world3 $tmp/ --exclude database --exclude rollback.sqlite
|
su - $user -c "ionice -c3 rsync -arptg $configdir $worldsdir/$world2 $worldsdir/$world3 $tmp/ --exclude database --exclude map.db --exclude rollback.sqlite"
|
||||||
|
|
||||||
echo "dump the worlds to the previously excluded"
|
echo "stop Minetest servers"
|
||||||
# folder. later it should be possible to
|
systemctl stop $world3Minetest
|
||||||
# use the world directory without additional
|
echo "give Minetest some time...."
|
||||||
# effort but we had to make shure the dump
|
sleep 5
|
||||||
# was done cleanly and using open files from
|
echo "stop DB servers"
|
||||||
# ssdb may result in bad situations.
|
systemctl stop $world3Database
|
||||||
#
|
sleep 2
|
||||||
#ionice -c3 $dumptool $ip $port1 $tmp/$world1/database
|
|
||||||
#ionice -c3 $dumptool $ip $port2 $tmp/$world2/database
|
|
||||||
ionice -c3 $dumptool $ip $port3 $tmp/$world3/database
|
|
||||||
|
|
||||||
echo "packing..."
|
echo "compress the worlds"
|
||||||
#
|
# TODO make the archive structure more logical (see alone map.db)
|
||||||
ionice -c3 tar -czf $backupfile $tmp/*
|
su - $user -c "ionice -c3 tar -czf $backupfile $tmp/* $worldsdir/$world3/map.db"
|
||||||
rm -rf $tmp
|
|
||||||
sftpdir=/home/illuna/mnt
|
|
||||||
#curlftpfs dedibackup-dc3.online.net/illuna $sftpdir
|
|
||||||
#cp $backupfile $sftpdir
|
|
||||||
|
|
||||||
/usr/local/bin/mc cp $backupfile t1/backups/minetest/
|
systemctl start $world3Database
|
||||||
|
sleep 2
|
||||||
|
systemctl start $world3Minetest
|
||||||
|
|
||||||
|
su - $user -c "rm -rf $tmp"
|
||||||
|
|
||||||
|
su - $user -c "/usr/local/bin/mc cp $backupfile t1/backups/minetest/"
|
||||||
# vacuum the backup directory
|
# vacuum the backup directory
|
||||||
#
|
#
|
||||||
rm -rf $backupfile
|
su - $user -c "rm -rf $backupfile"
|
||||||
/usr/local/bin/mc rm --force --older-than=4 t1/backups/minetest/
|
su - $user -c "/usr/local/bin/mc rm --force --older-than=4 t1/backups/minetest/"
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user