Advertisement
sergio_educacionit

backup.sh

Sep 14th, 2022
138
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.69 KB | None | 0 0
  1. #!/bin/bash
  2. device=97102854-980f-44c8-8c6a-a47d1acea6a9
  3. mount_device () {
  4. if [ $1 == mount ];then
  5. mount UUID=$device /mnt/backup
  6. /root/mount_win.sh
  7.  
  8. elif [ $1 == umount ];then
  9. umount /mnt/backup
  10. umount /mnt/windows
  11. fi
  12. }
  13.  
  14. case $1 in
  15. poweroff)
  16. mount_device mount
  17. rsnapshot daily
  18. sleep 60
  19. mount_device umount
  20. init 0
  21. ;;
  22. restore)
  23. mount_device mount
  24. ;;
  25. backup)
  26. mount_device mount
  27. rsnapshot daily
  28. sleep 60
  29. mount_device umount
  30. ;;
  31.  
  32. *)
  33. echo ""
  34. echo "$0 <poweroff|backup|restore>"
  35. echo ""
  36. echo "poweroff: backup and shutdown system"
  37. echo "backup: only backup"
  38. echo "mount: mount backup device to restore files"
  39. echo""
  40. ;;
  41. esac
  42.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement