No Description
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

backup.sh 875B

12345678910111213141516171819202122232425262728293031323334353637383940
  1. #! /bin/bash
  2. set -e
  3. (
  4. if ! flock -x -w $FLOCK_WAIT 200 ; then
  5. echo 'ERROR: Could not obtain lock. Exiting.'
  6. exit 1
  7. fi
  8. # Run pre-backup scripts
  9. for f in /scripts/backup/before/*; do
  10. if [ -f $f -a -x $f ]; then
  11. bash $f
  12. fi
  13. done
  14. duplicity \
  15. $1 \
  16. --asynchronous-upload \
  17. --log-file /root/duplicity.log \
  18. --name $BACKUP_NAME \
  19. $OPT_ARGUMENTS \
  20. $PATH_TO_BACKUP \
  21. $BACKUP_DEST
  22. if [ -n "$CLEANUP_COMMAND" ]; then
  23. duplicity $CLEANUP_COMMAND \
  24. --log-file /root/duplicity.log \
  25. --name $BACKUP_NAME \
  26. $BACKUP_DEST
  27. fi
  28. # Run post-backup scripts
  29. for f in /scripts/backup/after/*; do
  30. if [ -f $f -a -x $f ]; then
  31. bash $f
  32. fi
  33. done
  34. ) 200>/var/lock/duplicity/.duplicity.lock