Skip to content

Instantly share code, notes, and snippets.

@sydlawrence
Created March 12, 2013 10:52
Show Gist options
  • Save sydlawrence/5141976 to your computer and use it in GitHub Desktop.
Save sydlawrence/5141976 to your computer and use it in GitHub Desktop.
#!/bin/bash
TIMESTAMP=`date +%F-%H%M`
S3_BUCKET_NAME="wmasbackups" #replace with your bucket name on Amazon S3
S3_BUCKET_PATH="user-backups"
USER_NAME="syd"
echo "compressing user folder"
# Compressing
tar cf $USER_NAME-$HOSTNAME-$TIMESTAMP.tar /home/$USER_NAME/
echo "backing up /home/$USER_NAME/ to s3://$S3_BUCKET_NAME/$S3_BUCKET_PATH/$USER_NAME-$HOSTNAME-$TIMESTAMP/"
# Upload to S3
s3cmd put $USER_NAME-$HOSTNAME-$TIMESTAMP.tar s3://$S3_BUCKET_NAME/$S3_BUCKET_PATH/$USER_NAME-$HOSTNAME-$TIMESTAMP.tar
echo "all backed up :)"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment