Backing up multiple directories to S3 with Duplicity

Michael Rush
DF Studio Software Development
1 min readFeb 12, 2016

--

We recently setup a new dev server and configured it backup to S3 using Duplicity using kappataumu’s helpful article Cloud backups with Duplicity and Amazon S3.

In our case we wanted to backup a handful of specific directories on a regular basis (the rest of the server is backed up via a weekly snapshot). However, the script shown in the article was for only one directory.

Here’s a slight modification to the script that provides a way to backup multiple directories using Duplicity by using a bash function:

duplicity_backup(){
SRC_PATH=$1
DEST_PATH=$2
duplicity \
--verbosity notice \
--s3-use-new-style \
--encrypt-key="$GPG_KEY" \
--sign-key="$GPG_KEY" \
--full-if-older-than 7D \
--asynchronous-upload \
--volsize=100 \
--log-file "$HOME/.duplicity/notice.log" \
"$SRC_PATH" \
s3+http://$S3_BUCKET/$DEST_PATH
}
duplicity_backup "/path/to/first/source" source_one
duplicity_backup "/path/to/second/source" source_two

Mar 2, 2015

--

--