Is it necessary to backup S3?
aolnerd: keep multiple snapshots so that you can recover files after you delete them yourself.#!/bin/shAWS_ACCESS_KEY_ID=<>AWS_SECRET_ACCESS_KEY=<>BUCKET=<>DIR=<>S3SYNC=/usr/bin/s3sync.rbDAYS_TO_KEEP_BACKUPS=30# colons in path confuse s3syncDATE=$(date +%F_%H-%M-%S)NEWEST=$(/bin/ls -r $DIR | grep -v current | head -1)# copy the newest copy of files into a new directory, creating hardlinks instead of duplicate filescp -al $DIR/$NEWEST/ $DIR/$DATE/# sync the s3 bucket against the new directory$S3SYNC --recursive --make-dirs --delete --no-md5 -v $BUCKET: $DIR/$DATE/  2>&1 | grep -v 'Could not change owner'# update the "current" symlink linktest -e $DIR/current && rm $DIR/currentln -sf $DIR/$DATE $DIR/current# remove snapshots older than DAYS_TO_KEEP_BACKUPS daysfind $DIR -maxdepth 1 -type d -mtime +$DAYS_TO_KEEP_BACKUPS -print0 | xargs -0 --no-run-if-empty rm -rv