[[PageOutline(2-5, Table of Contents, floated)]] = S3QL Backup Script = Following is a modified version of the [http://www.rath.org/s3ql-docs/contrib.html#s3-backup-sh s3_backup.sh] script which which was provided by the Debian package at `/usr/share/doc/s3ql/examples/s3ql_backup.sh`. It expects a `/etc/s3ql/SERVERNAME` file listing directories to be backed up for each server and the SERVERNAME is expected to match the bucket name. == s3ql_backup == {{{ #!bash #!/bin/bash # Abort entire script if any command fails set -e # This script assumes that bucketname and directory under # /media match and is also assumes that a file, with the # same name with a list of directories to backup exists # in /etc/s3ql CONFIG_DIR="/etc/s3ql" # S3 server URL SERVER="s3c://s.qstack.advania.com:443" # mount directory for s3ql file systems MOUNT="/media/s3ql" # optional base source directory for for files to # backup, this is used because all the servers are # rsync command RSYNC="rsync -aHAXx --delete-during --delete-excluded --partial -v" # Check for bucket name / directory on standard input if [[ $1 ]]; then BUCKET=$1 elif [[ ! $1 ]]; then echo "Type the bucketname and then [ENTER]:" read bucket BUCKET=$bucket fi # sshfs mounted at /media/server-name SOURCE="/media/$BUCKET" # Check that a list of diectories to backup exists at # $CONFIG_DIR/$BUCKET if [[ ! -f "$CONFIG_DIR/$BUCKET" ]]; then echo "You need to create $CONFIG_DIR/$BUCKET with a list of directories to backup" exit else BACKUP_LIST="$CONFIG_DIR/$BUCKET" fi # The following two commands are commented out as the mnt-s3ql script covers # this and is run via cron before this script is run # Recover cache if e.g. system was shut down while fs was mounted #fsck.s3ql --backend-options="dumb-copy" --batch "$SERVER/$BUCKET" # Mount file system #mount.s3ql --backend-options="dumb-copy" "$SERVER/$BUCKET" "$MOUNT/$BUCKET" # Figure out the most recent backup cd "$MOUNT/$BUCKET" LAST_BACKUP=`python <