Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #! /bin/bash
- # Minecraft Backup Script
- # Tim Hunter <ionstorm66@gmail.com>
- #
- # This Program is free from any and all copyrights.
- #
- # Requires one argument, which is the world folder.
- # I.E.: /opt/minecraft/world/ the arg is world
- #
- # Start config
- #
- Log = '/opt/minecraft/log/backup.log'
- MCDir = '/opt/minecraft/'
- BackupDir = '/backup/mc/'
- #
- # End of config
- #
- echo World: $1 Backup Started `date` >> $Log
- # Make the backupt folder if it dose not exist
- mkdir -p $BackupDir`date +%H`/$1/
- # rsync the last backup to the new backup. Makes the actual backup quicker.
- rsync -az --inplace $BackupDir`date -d "-1 hour" +%H`/$1/* $BackupDir`date +%H`/$1/
- #
- # Need some way to get the minecraft server to save all data, and stop saving
- #
- # Backup the world with rsync
- rsync -az --delete --inplace $MCDir$1/* $BackupDir`date +%H`/$1/; STATUS="$?"
- # See if the backup went though.
- # Very basic check, but it catches a few problems.
- if [ "$STATUS" = "0" ]
- then
- echo World: world_1 Backup Completed `date` >> $Log
- # notify of succsess
- else
- echo World: world_1 Backup Failed `date` >> $Log
- # notify of failure
- fi
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement