Minetest:Backup

From Rabbi Blog

Jump to: navigation, search

Backing up your world is highly recommended, especially when experimenting with Minetest:Mods.

Linux

Backup Script

This script is under testing and editing or adding additional script approaches is welcomed. Ideally the script would be run as a cronjob.

Script

ps -A|grep -i minetest
ps auxwww|grep -i minetest|awk '{print "kill -9 "$2}' |sh
ps -A|grep -1 minetest
NOW=$(date +"%Y%m%d%H%M")
tar -zcf "minetest4_$NOW.tar.gz" minetest4
rm debug.txt
rm nohup.out
nohup ./minetest4/bin/minetestserver &
ps -A|grep -i minetest

Explanation

  1. visually show if minetest is running
  2. find and kill the process
  3. verify it is not running visually
  4. get today's date and time
  5. create a gzip file of the entire minetest server directory
  6. remove the debug.txt file (housecleaning)
  7. remove the nohup.out file (housecleaning)
  8. start the server running again under nohup
  9. visually show if minetest is running