Backup a directory to S3. The script make full backups every 30 days and incremental backups the rest of the time.
#!/bin/bash
if [ $# -lt 3] || [ $# -gt 3]; then
echo 'invalid number of parameters'
echo 'Usage: backup <folder-to-backup> <bucket-name> <folder-name>'
else
echo 'starting backup'
export PASSPHRASE=your_passphrase
export AWS_ACCESS_KEY_ID=your_aws_access_key
export AWS_SECRET_ACCESS_KEY=your_aws_secret_access_key
duplicity --extra-clean --full-if-older-than 1M $1 s3://s3.amazonaws.com/$1/$2
fi