mcbackup.sh 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. #!/bin/sh
  2. ####################################
  3. #
  4. # Backup minecraft world to a
  5. # specified folder.
  6. #
  7. ####################################
  8. day_raw=$(date +%A)
  9. case $day_raw in
  10. Sunday)
  11. day="Dimanche";;
  12. Monday)
  13. day="Lundi";;
  14. Tuesday)
  15. day="Mardi";;
  16. Wednesday)
  17. day="Mercredi";;
  18. Thursday)
  19. day="Jeudi";;
  20. Friday)
  21. day="Vendredi";;
  22. Saturday)
  23. day="Samedi";;
  24. *)
  25. ;;
  26. esac
  27. archive_file="$day-Minecraft"
  28. echo $archive_file.tar.gz
  29. cd /tmp
  30. tar -I pigz -cvf /tmp/$archive_file.tar.gz /home/dexter/minecraft/
  31. md5sum $archive_file.tar.gz > $archive_file.md5
  32. sudo mount -t cifs //mafreebox.freebox.fr/Disque\ dur/ /media/nas/ -o user=freebox,password=password,uid=1000,gid=1000,rw,vers=1.0
  33. sudo cp /tmp/$archive_file.tar.gz /media/nas/mc_backup
  34. sudo cp /tmp/$archive_file.md5 /media/nas/mc_backup
  35. sleep 6
  36. sudo umount /media/nas
  37. ncftpput -R -v -u "wareck" -p "zorn69" ftpperso.free.fr minecraft_bkp/ /tmp/$archive_file.tar.gz
  38. sleep 5
  39. ncftpput -R -v -u "wareck" -p "zorn69" ftpperso.free.fr minecraft_bkp/ /tmp/$archive_file.md5
  40. sleep 5
  41. sudo rm /tmp/$archive_file.tar.gz
  42. sudo rm /tmp/$archive_file.md5
  43. echo `date` "Backup done" >>/var/log/mc_backup/log