Created
February 13, 2013 18:33
-
-
Save TimWolla/4946930 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/php | |
<?php | |
$type = $argv[1]; | |
echo "Forcing map-save\n"; | |
exec("screen -p 0 -S ".$type." -X eval 'stuff \"save-off\"\015'"); | |
exec("screen -p 0 -S ".$type." -X eval 'stuff \"save-all\"\015'"); | |
exec("screen -p 0 -S ".$type." -X eval 'stuff \"say Backup gestartet\"\015'"); | |
$time = time(); | |
echo "Creating backup /home/minecraft/BACKUP/".$type."/world_".date('Y.m.d_H:i:s', $time).".tar.gz\n"; | |
exec('cd /home/minecraft/'.$type.' && tar -czvf /home/minecraft/BACKUP/'.$type.'/world_'.date('Y.m.d_H:i:s', $time).'.tar.gz world_new world_new_nether plugins --exclude dynmap', $output); | |
echo implode("\n", $output); | |
echo "\nDeleting old backups\n"; | |
exec('cd /home/minecraft/BACKUP/'.$type.'/ && find . -ctime +2 -exec rm {} \;'); | |
exec("screen -p 0 -S ".$type." -X eval 'stuff \"save-on\"\015'"); | |
exec("screen -p 0 -S ".$type." -X eval 'stuff \"say Backup beendet\"\015'"); | |
echo "Finished\n"; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment