Created
December 13, 2010 08:44
-
-
Save cocoy/738803 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 0 0 * * * /vol/conf/snapshot.sh >> /mnt/backup_ebs.log 2>&1 | |
| 0 2 * * * /vol/conf/manage_snaphost.sh >> /mnt/backup_ebs.log 2>&1 | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/sh | |
| # Filename: manage_snapshot.sh | |
| # | |
| if [ -f /mnt/VOLUME_USED ]; then | |
| VOLUME=`cat /mnt/VOLUME_USED` | |
| /usr/sbin/aws dsnap | grep $VOLUME | sort -r -k 5 | sed 1,10d | awk '{print "Deleting snapshot: " $2 " Dated: " $8}; system("/usr/sbin/aws delsnap " $2)' >> /mnt/backup_ebs.log | |
| fi |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/bash | |
| # Filename: snaphost.sh | |
| # | |
| # Run as inside cron. | |
| EBS_DIR=/vol | |
| PATH=$PATH:$HOME/bin:$EC2_HOME/bin:/usr/sbin | |
| if [ -f /mnt/VOLUME_USED ]; then | |
| VOLUME=`cat /mnt/VOLUME_USED` | |
| echo "Date: $(date)" | |
| /usr/bin/ec2-consistent-snapshot --description "$VOLUME $(date +\%F-\%T)" --mysql --xfs-filesystem $EBS_DIR $VOLUME | |
| /usr/sbin/xfs_freeze -u $EBS_DIR | |
| fi |
Author
Author
aws dvol | grep | grep device=/dev/sd[klmn] | awk '{ print $2}'
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
ec2-consistent-snapshot \ --mysql \ --xfs-filesystem /vol \ --region eu-west-1 \ --description "RAID snapshot $(date +'%Y-%m-%d %H:%M:%S')" \ vol-VOL1 vol-VOL2 vol-VOL3 vol-VOL4