Last active
December 23, 2015 02:58
-
-
Save x1024/6569982 to your computer and use it in GitHub Desktop.
Minecraft rolling backup script.
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
#!/bin/bash | |
echo "Backup perfomed at: `date +'%Y/%m/%d %H:%M'`" | |
echo "Backup perfomed at: `date +'%Y/%m/%d %H:%M'`" >> backups.log | |
# Make a backup | |
cp -r ~/unleashed/world ~/unleashed/backups/world_`date +%Y_%m_%d_%H_%M` | |
pushd ~/unleashed/backups | |
# Keep only the latest 50 backups | |
# First show what we're deleting | |
ls -t | sed -e '1,50d' | xargs -d '\n' echo | |
# Then delete it | |
ls -t | sed -e '1,50d' | xargs -d '\n' rm -r | |
popd |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment