Created
April 6, 2011 12:59
-
-
Save mikluko/905594 to your computer and use it in GitHub Desktop.
duplicity wrapper
This file contains 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 AWS_ACCESS_KEY_ID= | |
export AWS_SECRET_ACCESS_KEY= | |
export PASSPHRASE= | |
LOCATION= | |
BACKUP_OPTIONS=" | |
--exclude=**/.cache \ | |
--include=/etc \ | |
--include=/home \ | |
--include=/root \ | |
--include=/var/backups \ | |
--exclude=/var/lib/postgresql \ | |
--exclude=/var/lib/mysql \ | |
--include=/var/lib \ | |
--include=/var/log \ | |
--include=/var/mail \ | |
--include=/var/spool \ | |
--exclude=/**" | |
OPTIONS="--s3-use-new-style" | |
if [ $# -gt 1 ]; then | |
ACTION=$1 | |
shift | |
OPTIONS="${OPTIONS} $@" | |
else | |
ACTION=$@ | |
fi | |
DUPLICITY=/usr/bin/duplicity | |
case "$ACTION" in | |
full) | |
$DUPLICITY full $OPTIONS $BACKUP_OPTIONS / $LOCATION | |
;; | |
incr) | |
$DUPLICITY incremental $OPTIONS $BACKUP_OPTIONS / $LOCATION | |
;; | |
smart) | |
$DUPLICITY incremental --full-if-older-than 3M $OPTIONS $BACKUP_OPTIONS / $LOCATION | |
;; | |
cleanup) | |
$DUPLICITY remove-all-but-n-full 3 $OPTIONS --force $LOCATION | |
$DUPLICITY cleanup $OPTIONS --force $LOCATION | |
;; | |
status) | |
$DUPLICITY collection-status $OPTIONS $LOCATION | |
;; | |
*) | |
echo "Usage: $0 {full|incr|smart|cleanup|status}" | |
exit 1 | |
;; | |
esac | |
exit 0 | |
#EOF |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment