Guest User

Untitled

a guest
Feb 18th, 2019
110
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.61 KB | None | 0 0
  1. #!/bin/bash
  2.  
  3. EXCLUDE_REGEX='(cache|sess).+[a-z0-9]{26,}|_log$|\.log(.gz)?$'
  4. GLOBAL_ARGS="--skipNewer --keepDays 30 --threads 17 --excludeRegex $EXCLUDE_REGEX"
  5.  
  6. # usage example :
  7. #
  8. # ./backup-b2 $ACCOUNT_ID $APPLICATION_KEY << EOF
  9. # /var/www/html b2://mybucket/mysite
  10. # /etc/ssl b2://mybucket/mycerts
  11. # EOF
  12. #
  13. # ./backup-b2 < mybuckets.txt
  14. ###########
  15.  
  16. lock=/run/lock/b2backup
  17.  
  18. if [ -f "$lock" ]
  19. then
  20. exit 0
  21. fi
  22. touch "$lock"
  23. trap "rm \"$lock\"" EXIT
  24.  
  25. b2 authorize-account $@ || exit 1
  26.  
  27. while read -r A
  28. do
  29. if [[ "$A" == "" ]]
  30. then
  31. continue
  32. fi
  33. ionice -n7 nice -n 20 b2 sync $GLOBAL_ARGS $A
  34. done
Add Comment
Please, Sign In to add comment