Created
June 30, 2011 05:03
-
-
Save cocoy/1055668 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
#!/bin/bash | |
# | |
# Filaneme: ebs_backup | |
# | |
VOLUMES='' | |
EBS_DIR=/nfs-raid | |
ISMOUNTED=$(df -la | grep -c $EBS_DIR) | |
if [ $ISMOUNTED -gt 0 ];then | |
echo "/dev/md0 is mounted" | |
# check volumes | |
if [ -f /home/ubuntu/VOLUME_USED ]; then | |
VOLUMES=$(cat /home/ubuntu/VOLUME_USED) | |
echo "Snapshotting.." | |
# snapshot EBS volumes | |
ec2-consistent-snapshot \ | |
--aws-access-key-id ACCESS_KEY \ | |
--aws-secret-access-key SECRET_KEY \ | |
--freeze-filesystem /nfs-raid \ | |
--region us-west-1 \ | |
--description "NFS RAID snapshot $(date +'%Y-%m-%d %H:%M:%S')" \ | |
$VOLUMES | |
else | |
echo "/home/ubuntu/VOLUME_USED file not found" | |
exit 1 | |
fi | |
else | |
echo "Volume $EBS_DIR not mounted" | |
exit 1 | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment