Created
May 12, 2017 16:54
-
-
Save Kehet/ffda82cb0a1bb92860511ba15235cc33 to your computer and use it in GitHub Desktop.
Simple dublicity script
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
export PASSPHRASE=1234 | |
FTP_URL="sftp://user@host:port/file" | |
BK_FULL_FREQ="1M" # create a new full backup every... | |
BK_FULL_LIFE="6M" # delete any backup older than this | |
BK_KEEP_FULL="2" # How many full+inc cycle to keep | |
function makebackup() { | |
logfile=${1//\//-} | |
logfile=${logfile:1:${#logfile}} | |
duplicity --full-if-older-than $BK_FULL_FREQ $1 --asynchronous-upload "$FTP_URL/$1" | tee "/root/${logfile}.log" | |
duplicity remove-older-than $BK_FULL_LIFE --force "$FTP_URL/$1" | tee "/root/${logfile}.log" | |
duplicity remove-all-inc-of-but-n-full $BK_KEEP_FULL --force "$FTP_URL/$1" | tee "/root/${logfile}.log" | |
} | |
makebackup /etc | |
makebackup /var/log | |
unset PASSPHRASE |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment