Start
screen -dmS minecraft /srv/www/minecraft/start.sh
Backup
Eintrag in der crontab
# Minecraft Server sichern
#
00 */2 * * * root /srv/www/minecraft/save.sh
save.sh
#!/bin/bash
#
# Backup Minecraft Server
#
# Info an alle Benutzer
screen -x minecraft -X stuff "$(printf 'say Datensicherung startet ...\r')"
sleep 1
# Alles sichern und "offline" gehen
screen -x minecraft -X stuff "$(printf 'save-all\r')"
sleep 5
screen -x minecraft -X stuff "$(printf 'save-off\r')"
sleep 1
#
#
#
cd /srv/www/minecraft
FNAME=$(date +"%Y.%m.%d-%H:%M:%S")
7za a -r /srv/hdd/mc-$FNAME *
# wieder Online gehen
screen -x minecraft -X stuff "$(printf 'save-on\r')"
sleep 1
screen -x minecraft -X stuff "$(printf 'say Datensicherung beendet!\r')"
#