Advertisement
Guest User

Untitled

a guest
Apr 6th, 2014
102
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #!/bin/bash
  2.  
  3. backupdir='/home/marina/.flashdocs/'
  4. uuid='312E-2786'
  5. while true ; do
  6.  
  7. while [ "$flash" == "" ]; do
  8. flashname=$(blkid | grep "$uuid" | sed 's/:.*$//')
  9. if [ "$flashname" != "" ]; then
  10. flash=$(mount | grep $flashname | sed 's/^.*on //;s/ type.*$//')
  11. fi
  12. done
  13. shopt -s dotglob
  14. rsync -a --delete "$flash/" "$backupdir" | tee >(zenity --progress --pulsate --no-cancel --auto-close --text="Идет резервное копирование. Не отключай флешку.")
  15.  
  16.  
  17. while [ "$flash" != "" ]; do
  18. inotifywait -e close_write -e move -e delete -r "$flash"
  19. sleep 1
  20. rsync -a --delete "$flash/" "$backupdir"
  21. sync
  22. #sleep 1
  23. flash=$(mount | grep $flashname | sed 's/^.*on //;s/ type.*$//')
  24. done
  25. rdiff-backup --remote-schema "ssh -C -p9889 %s rdiff-backup --server" $backupdir user@server::/files/marina/ | tee >(zenity --progress --pulsate --no-cancel --auto-close --text="Идет резервное копирование. Не выключай компьютер.")
  26. done
Advertisement
RAW Paste Data Copied
Advertisement