Guest User

backup_world.sh

a guest
Oct 22nd, 2020
20
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. # Backup 8675309 worlds
  2. date;
  3. du /opt/minecraft/server/snapshots/ -h;
  4.  
  5. echo "Save World Now"
  6. /opt/minecraft/tools/mcrcon/mcrcon -H HOSTNAME -P MCRCON_PORT -p MCRCON_PASS save-all;
  7. echo "sleep 10 sec"
  8. /usr/bin/sleep 10s;
  9. echo "Disable Saving"
  10. /opt/minecraft/tools/mcrcon/mcrcon -H HOSTNAME -P MCRCON_PORT -p MCRCON_PASS save-off;
  11. echo "Clear Old Backups"
  12. #find /opt/minecraft/server/snapshots/* -mtime +2 -exec rm {} \
  13. /usr/bin/find /opt/minecraft/server/snapshots/*.zip -mtime +14 -exec rm {} \;
  14. echo "Begin Backups"
  15. cd /opt/minecraft/server/
  16. /usr/bin/zip -v snapshots/8675309/`date "+%Y-%m-%d-%H-%M-%S"`.zip -r 8675309;
  17. /usr/bin/zip -v snapshots/8675309_nether/`date "+%Y-%m-%d-%H-%M-%S"`.zip -r 8675309_nether;
  18. /usr/bin/zip -v snapshots/8675309_the_end/`date "+%Y-%m-%d-%H-%M-%S"`.zip -r 8675309_the_end;
  19. echo "Enable Saving"
  20. /opt/minecraft/tools/mcrcon/mcrcon -H HOSTNAME -P MCRCON_PORT -p MCRCON_PASS save-on;
  21.  
  22. du /opt/minecraft/server/snapshots/ -h;
  23. date;
  24.  
  25. #exit 0;
RAW Paste Data