Created
August 29, 2020 09:10
-
-
Save Epse/d57193bedfc3d134bb1e371651638f85 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/env bash | |
tempdir=$(mktemp -d) | |
timestamp=$(date --iso-8601) | |
echo "Tempdir $tempdir" | |
echo "Timestamp $timestamp" | |
cd "$tempdir" | |
# Copy creative | |
echo "Broadcasting backup to creative" | |
mcrcon -P 25576 -p passw0rd -w 2 "say Creating backup! Expect a slowdown." save-off "save-all flush" | |
echo "Copying creative" | |
cp -r /home/creative/creative . | |
echo "Enabling saving on creative" | |
mcrcon -P 25576 -p passw0rd -w 2 save-on | |
echo "Compressing creative" | |
tar -czf "creative_${timestamp}.tar.gz" ./creative | |
mv --backup=t "creative_${timestamp}.tar.gz" /home/backup/backups/creative/ | |
# Copy survival | |
echo "Broadcasting backup to survival" | |
mcrcon -P 25575 -p passw0rd -w 2 "say Creating backup! Expect a slowdown." save-off "save-all flush" | |
echo "Copying survival" | |
cp -r /home/survival/survival . | |
echo "Enabling saving on survival" | |
mcrcon -P 25575 -p passw0rd -w 2 save-on | |
echo "Compressing survival" | |
tar -czf "survival_${timestamp}.tar.gz" ./survival | |
mv --backup=t "survival_${timestamp}.tar.gz" /home/backup/backups/survival/ | |
# Cleanup | |
echo "Cleaning up" | |
cd | |
rm -rf "$tempdir" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment