Created
December 13, 2010 08:44
-
-
Save cocoy/738803 to your computer and use it in GitHub Desktop.
This file contains 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 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 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 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
aws dvol | grep | grep device=/dev/sd[klmn] | awk '{ print $2}'