2018-04-01 05:18:01 +02:00
|
|
|
#!/bin/bash
|
|
|
|
|
2019-02-13 23:07:44 +01:00
|
|
|
# Variables à modifier
|
|
|
|
bdd=nalc-0.4.17
|
|
|
|
worldname=nalc
|
|
|
|
servername=nalc-server-0.4.17-r1
|
|
|
|
|
|
|
|
serverpath=/home/minetest/$servername
|
|
|
|
bak=$serverpath/backup
|
|
|
|
world=$serverpath/minetest/worlds/$worldname
|
|
|
|
|
2018-04-01 05:18:01 +02:00
|
|
|
if [[ ! -d $bak ]]; then
|
2019-02-13 23:07:44 +01:00
|
|
|
mkdir -p $bak
|
2018-04-01 05:18:01 +02:00
|
|
|
fi
|
|
|
|
|
2019-02-13 23:07:44 +01:00
|
|
|
bak_tmp=/var/tmp/$servername
|
2018-04-01 05:18:01 +02:00
|
|
|
if [[ ! -d $bak_tmp ]]; then
|
2019-02-13 23:07:44 +01:00
|
|
|
mkdir $bak_tmp
|
2018-04-01 05:18:01 +02:00
|
|
|
fi
|
|
|
|
|
2019-02-13 23:07:44 +01:00
|
|
|
cp $serverpath/minetest/minetest.conf $bak/
|
|
|
|
cp $serverpath/start.sh $bak/
|
|
|
|
cp $serverpath/backup.sh $bak/
|
|
|
|
cp $serverpath/shutdown.sh $bak/
|
|
|
|
|
|
|
|
pushd $world
|
|
|
|
rm -r rollback.sqlite
|
|
|
|
tar -I pbzip2 -cf $bak/world.tar.bz2 .
|
|
|
|
popd
|
|
|
|
|
|
|
|
pg_dump -F c -f $bak_tmp/$bdd.dump $bdd
|
|
|
|
pg_dump -F c -f $bak_tmp/players-$bdd.dump players-$bdd
|
|
|
|
|
|
|
|
pushd $bak_tmp
|
|
|
|
tar --label=SQL_DUMP-$servername -cf $bak/dump_sql.tar --remove-files *.dump
|
|
|
|
popd
|
|
|
|
|
|
|
|
log_dir=$serverpath/logs
|
|
|
|
[[ ! -d $log_dir ]] && mkdir $log_dir
|
|
|
|
pushd $log_dir
|
|
|
|
if [[ -f moredebug.log ]]; then
|
|
|
|
d=$(date +%Y-%m-%d.%H.%M.%S)
|
|
|
|
mv moredebug.log moredebug_$d.log
|
|
|
|
bzip2 moredebug_$d.log
|
|
|
|
tar --label=LOGS-$servername -rf moredebug-logs.tar --remove-files moredebug*.log.bz2
|
2018-04-01 05:18:01 +02:00
|
|
|
fi
|
2019-02-13 23:07:44 +01:00
|
|
|
popd
|