Browse Source

Ajout de divers scripts

pull/3/head
sys4-fr 3 years ago
parent
commit
a906252c13
  1. 60
      backup.sh
  2. 4
      install.sh
  3. 2
      minetest-0.4.conf
  4. 11
      shutdown.sh
  5. 13
      start.sh.example

60
backup.sh

@ -1,31 +1,47 @@
#!/bin/bash
bak=/home/minetest/nalc-server-0.4/backup
# 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
if [[ ! -d $bak ]]; then
mkdir $bak
mkdir -p $bak
fi
bak_tmp=/var/tmp/nalc-0.4_dump
bak_tmp=/var/tmp/$servername
if [[ ! -d $bak_tmp ]]; then
mkdir $bak_tmp
mkdir $bak_tmp
fi
rm -r /home/minetest/nalc-server-0.4/minetest/worlds/nalc/rollback.sqlite
tar -I pbzip2 -cvf $bak/world.tar.bz2 /home/minetest/nalc-server-0.4/minetest/worlds/nalc
pg_dump nalc-0.4 > $bak_tmp/nalc-0.4.sql
pg_dump players-nalc-0.4 > $bak_tmp/players-nalc-0.4.sql
if [[ -e $bak/dump_sql.tar.bz2 ]]; then
cd $bak
tar -jxvf dump_sql.tar.bz2
cd ..
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
fi
rdiff-backup --no-file-statistics $bak_tmp $bak
cd $bak
tar -I pbzip2 -cvf dump_sql.tar.bz2 --remove-files *.sql
cd ..
rm -rf $bak_tmp
popd

4
install.sh

@ -337,7 +337,9 @@ post_install() {
if [[ ! -a start.sh ]]; then
cp start.sh.example ./start.sh
echo "Veuiller éditer le fichier start.sh"
echo "Veuillez éditer le fichier $(pwd)/start.sh"
echo "Veuillez éditer le fichier $(pwd)/backup.sh"
echo "Veuillez éditer le fichier $(pwd)/shutdown.sh"
fi
# fix technic_worldgen crash

2
minetest-0.4.conf

@ -165,7 +165,7 @@ mob_chance_multiplier = 0.5
#kpgmobs:deer = 51000,1
#kpgmobs:jeraf = 51000,1
#kpgmobs:medved = 100000,1
#creeper:creeper = 25000,2
creeper:creeper = 50000,2
#mob_horse:horse = 60000,1
#mobs_turtles:turtle = 30000,1
#mobs_turtles:seaturtle = 30000,1

11
shutdown.sh

@ -0,0 +1,11 @@
#!/bin/bash
serverpath=/home/minetest/nalc-server-0.4.17-r1
kill -s TERM $(pidof minetestserver)
sleep 10
kill -s TERM $(pidof -x $serverpath/start.sh)
$serverpath/backup.sh
$serverpath/start.sh&
exit 0

13
start.sh.example

@ -1,9 +1,12 @@
#!/bin/bash
DEBUG=~/nalc-server/logs/debug.log
MOREDEBUG=~/nalc-server/logs/moredebug.log
serverpath=/home/minetest/nalc-server
world=$serverpath/minetest/worlds/nalc
cd ~/nalc-server/minetest/bin
DEBUG=$serverpath/logs/debug.log
MOREDEBUG=$serverpath/logs/moredebug.log
cd $serverpath/minetest/bin
while true
do
@ -16,8 +19,8 @@ while true
echo "0" >/tmp/players_c.txt
./minetestserver \
--world ../worlds/nalc/ \
--config ../minetest.conf \
--world $world/ \
--config $serverpath/minetest/minetest.conf \
--gameid nalc_game \
--port 30002 \
# --logfile $DEBUG

Loading…
Cancel
Save