Skip to content

Instantly share code, notes, and snippets.

@bradymholt
Created October 26, 2012 03:10
Show Gist options
  • Save bradymholt/3956653 to your computer and use it in GitHub Desktop.
Save bradymholt/3956653 to your computer and use it in GitHub Desktop.
ec2-create-rolling-snapshot wrapper
#!/bin/sh
#Stop mysql to ensure snapshot consistancy
echo "Stopping mysql..."
/sbin/service mysqld stop
echo "Creating snapshot..."
export AWS_ACCESS_KEY="AKIDDDDDDDDDDDD"
export AWS_SECRET_KEY="GQYL9/JKCFNbZ/2/DDDDDDDDDDDDDDDD"
export EC2_HOME=/opt/aws/apitools/ec2
export JAVA_HOME=/usr/lib/jvm/jre
~/ec2-create-rolling-snapshot -d "Daily backup-vol-fac00d0d" vol-fac00d0d 7
echo "Waiting for snapshot to finish building..."
sleep 10
echo "Starting mysql..."
/sbin/service mysqld start
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment