Skip to content

Commit

Permalink
Bug fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
SeanBannister committed Aug 31, 2011
1 parent 3001c18 commit 8a26fba
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 7 deletions.
4 changes: 2 additions & 2 deletions bin/i-attach-volume
Expand Up @@ -87,8 +87,8 @@ echo "/dev/xvdk$DEVICE_NUMBER $MOUNT_POINT ext4 noatime 0 0" >> /etc/fstab
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 * * * root i-snapshot-volume $MOUNT_POINT true true" >> /etc/cron.d/snapshot-ebs
echo "Adding cron entry for ec2-consistent-snapshot to '/etc/cron.d/snapshot-ebs'..."
echo "30 4 * * * root /usr/local/aws-helper-scripts/bin/i-snapshot-volume $MOUNT_POINT true true" >> /etc/cron.d/snapshot-ebs
echo

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

# Remove the crontab entry that performs EBS Snapshots for this Volume
CRONTAB_CONTENT=$(grep " i-snapshot-volume $MOUNT_POINT " /etc/cron.d/snapshot-ebs);
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/snapshot-ebs' crontab:"
echo "$CRONTAB_CONTENT"
cp /etc/cron.d/ebs-snapshots /tmp/ebs-snapshots.bak
grep -v " i-snapshot-volume $MOUNT_POINT " /tmp/ebs-snapshots.bak > /etc/cron.d/snapshot-ebs
cp /etc/cron.d/snapshot-ebs /tmp/ebs-snapshots.bak
grep -v "i-snapshot-volume $MOUNT_POINT " /tmp/ebs-snapshots.bak > /etc/cron.d/snapshot-ebs
else
echo "Cron entry wasn't found in /etc/cron.d/snapshot-ebs"
fi
Expand All @@ -99,9 +99,8 @@ echo
# Detach the EBS Volume
if [ "$VOLUME_ID" ]; then
echo "Detaching EBS Volume..."
ec2-detach-volume $VOLUME_ID --instance $INSTANCE_ID
# Wait for EBS volume to detach before doing anything else
while ! ec2-detach-volume $VOLUME_ID; do sleep 1; done
while ! ec2-detach-volume $VOLUME_ID --instance $INSTANCE_ID; do sleep 1; done
echo
fi

Expand Down

0 comments on commit 8a26fba

Please sign in to comment.