Guest User

Untitled

a guest
Jul 10th, 2013
176
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #!/bin/sh
  2.  
  3. ###### some variables
  4. src="/home/bukkit/bukkit"
  5. dst="/home/bukkit/backup/luxcraft"
  6.  
  7. ####### First thing to do: save-all and save-off to console
  8. screen -S luxcraft -p 0 -X stuff "save-all$(echo -ne '\r')"
  9. screen -S luxcraft -p 0 -X stuff "save-off$(echo -ne '\r')"
  10.  
  11. ###### The sync itself :P
  12.  
  13. mv $dst/luxcraft-`date --date='5 days ago' +%F` $dst/luxcraft-`date +%F`
  14. rsync -av --delete $src/ $dst/luxcraft-`date +%F`/
  15.  
  16. ####### Last thing to do: save-on and save-all to console
  17. screen -S luxcraft -p 0 -X stuff "save-on$(echo -ne '\r')"
  18. screen -S luxcraft -p 0 -X stuff "save-all$(echo -ne '\r')"
  19.  
  20. # Do MySQL dumps
  21. /usr/bin/mysqldump -u someuser --password=somepass --skip-opt logblock > /home/bukkit/backup/luxcraft/sql/logblock-`date +%F`.sql
  22. /usr/bin/mysqldump -u someuser --password=somepass --skip-opt ontime > /home/bukkit/backup/luxcraft/sql/ontime-`date +%F`.sql
  23.  
  24. # zip em to save space
  25. gzip /home/bukkit/backup/luxcraft/sql/logblock-`date +%F`.sql
  26. gzip /home/bukkit/backup/luxcraft/sql/ontime-`date +%F`.sql
  27.  
  28. # Don't save db backups for very long :P
  29. rm /home/bukkit/backup/luxcraft/sql/*`date --date='5 days ago' +%F`*
RAW Paste Data