Skip to content

Instantly share code, notes, and snippets.

@javierav javierav/system-backup.sh
Last active Jan 4, 2018

Embed
What would you like to do?
#!/usr/bin/env bash
#
## Este script ejecuta un backup del sistema en Amazon S3
#
export AWS_ACCESS_KEY_ID=""
export AWS_SECRET_ACCESS_KEY=""
export AWS_BACKUP_NAME="example-bucket"
LOGFILE="/var/log/duplicity/backup.log"
if [ ! -d /var/log/duplicity ]; then
mkdir -p /var/log/duplicity
fi
trace () {
stamp=`date +%Y-%m-%d_%H:%M:%S`
echo "$stamp: $*" >> ${LOGFILE}
}
trace "Backup for local filesystem started"
/usr/local/bin/duplicity \
--s3-use-new-style \
--s3-european-buckets \
--no-encryption \
--verbosity info \
--full-if-older-than 1M \
--include=/home/pi \
--include=/var/www \
--include=/etc \
--exclude=/** \
/ s3://s3.amazonaws.com/${AWS_BACKUP_NAME}/ >> ${LOGFILE} 2>&1
trace "Backup for local filesystem complete"
trace "------------------------------------"
unset AWS_ACCESS_KEY_ID
unset AWS_SECRET_ACCESS_KEY
unset AWS_BACKUP_NAME
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.