Skip to content

Commit

Permalink
Updating code that relates to snapshotting EBS volumes from cron
Browse files Browse the repository at this point in the history
  • Loading branch information
SeanBannister committed Aug 31, 2011
1 parent d6a0d6c commit 3001c18
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion bin/i-attach-volume
Expand Up @@ -88,7 +88,7 @@ echo

# Add cron entry to perform EBS Snapshots of this Volume
echo "Adding cron entry for ec2-consistent-snapshot to '/etc/cron.d/ebs-snapshots'..."
echo "30 4 * * * i-create-snapshot $MOUNT_POINT true" >> /etc/cron.d/ebs-snapshots
echo "30 4 * * * root i-snapshot-volume $MOUNT_POINT true true" >> /etc/cron.d/snapshot-ebs
echo

echo "Creating mount point and mounting device..."
Expand Down
8 changes: 4 additions & 4 deletions bin/i-detach-volume
Expand Up @@ -83,15 +83,15 @@ fi
echo

# Remove the crontab entry that performs EBS Snapshots for this Volume
CRONTAB_CONTENT=$(grep " i-create-snapshot $MOUNT_POINT " /etc/cron.d/ebs-snapshots);
CRONTAB_CONTENT=$(grep " i-snapshot-volume $MOUNT_POINT " /etc/cron.d/snapshot-ebs);

if [ "$CRONTAB_CONTENT" ]; then
echo "Removing the following entries from the '/etc/cron.d/ebs-snapshots' crontab:"
echo "Removing the following entries from the '/etc/cron.d/snapshot-ebs' crontab:"
echo "$CRONTAB_CONTENT"
cp /etc/cron.d/ebs-snapshots /tmp/ebs-snapshots.bak
grep -v " i-create-snapshot $MOUNT_POINT " /tmp/ebs-snapshots.bak > /etc/cron.d/ebs-snapshots
grep -v " i-snapshot-volume $MOUNT_POINT " /tmp/ebs-snapshots.bak > /etc/cron.d/snapshot-ebs
else
echo "No cron entries fournd in /etc/cron.d/ebs-snapshots"
echo "Cron entry wasn't found in /etc/cron.d/snapshot-ebs"
fi

echo
Expand Down

0 comments on commit 3001c18

Please sign in to comment.