Guest User

duplicity + stack

a guest
Jan 16th, 2016
515
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 1.15 KB | None | 0 0
  1. #!/bin/sh
  2. #Put password in /etc/duplicity/.passphrase and chmod to 600(!)
  3. INCREMENTS=365
  4. LOGFILE=" --log-file /var/log/duplicity.log"
  5. KEYID="CFAAE3DDD"
  6. MOUNTDIR="/data"
  7. LOG_LOCATION="/etc/duplicity"
  8. test -x $(which duplicity) || exit 0
  9. . /etc/duplicity/.passphrase
  10.  
  11. #Umount stackmount
  12. if sudo -u user mount | grep "stack"  
  13. then
  14. #echo "Unmount already mounted stack directory, just to be sure"
  15. sudo -u user umount  $MOUNTDIR  
  16. fi
  17.  
  18. export PASSPHRASE
  19. if sudo -u user mount $MOUNTDIR
  20. then
  21.  
  22.     ##Don't forget to define with three /// for local directories!
  23.  
  24.     #mysql
  25.     $(which duplicity)  --encrypt-key $KEYID $LOGFILE --num-retries 3 --sign-key $KEYID  /var/lib/automysqlbackup    file:///data/mysql
  26.     $(which duplicity) remove-all-but-n-full $INCREMENTS --force file:///data/mysql
  27.        
  28.    
  29.     #Umount stackmount                                                                      
  30.         if sudo -u user mount | grep "stack"
  31.         then
  32.         #echo "Umounting stack directory"                                                                                  
  33.         sudo -u user umount  $MOUNTDIR
  34.         fi    
  35. else
  36.     echo "Mount failed, please check $MOUNTDIR"
  37. fi
Advertisement
Add Comment
Please, Sign In to add comment