From 3b8088d88563c086a8b6e301206b5cbc0606a22d Mon Sep 17 00:00:00 2001 From: nathanblogs Date: Wed, 18 Jun 2014 16:41:50 +0800 Subject: [PATCH] Update ec2-automate-backup-awscli.sh Looks like the awscli tools added the encrypted flag to it's response, this breaks the cut on the outputs. --- ec2-automate-backup/ec2-automate-backup-awscli.sh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/ec2-automate-backup/ec2-automate-backup-awscli.sh b/ec2-automate-backup/ec2-automate-backup-awscli.sh index f7f9c34..08eab15 100755 --- a/ec2-automate-backup/ec2-automate-backup-awscli.sh +++ b/ec2-automate-backup/ec2-automate-backup-awscli.sh @@ -49,7 +49,7 @@ get_EBS_List() { echo -e "An error occured when running ec2-describe-volumes. The error returned is below:\n$ebs_backup_list_complete" 1>&2 ; exit 70 fi #returns the list of EBS volumes that matched ebs_selection_string. grep ^VOLUMES is to remove lines that begin "TAGS Backup" - ebs_backup_list=$(echo "$ebs_backup_list_complete" | grep ^VOLUMES | cut -f 7) + ebs_backup_list=$(echo "$ebs_backup_list_complete" | grep ^VOLUMES | cut -f 8) } create_EBS_Snapshot_Tags() { @@ -115,7 +115,7 @@ purge_EBS_Snapshots() { snapshot_tag_list=$(aws ec2 describe-snapshots --region $region --filters Name=tag:PurgeAllow,Values=true --output text | grep ^SNAPSHOTS) # snapshot_purge_allowed is a string containing Snapshot IDs that are # allowed to be purged - snapshot_purge_allowed=$(echo "$snapshot_tag_list" | cut -f 5) + snapshot_purge_allowed=$(echo "$snapshot_tag_list" | cut -f 7) for snapshot_id_evaluated in $snapshot_purge_allowed; do #gets the "PurgeAfterFE" date which is in UTC with UNIX Time format (or xxxxxxxxxx / %s) @@ -212,7 +212,7 @@ for ebs_selected in $ebs_backup_list; do if [[ $? != 0 ]]; then echo -e "An error occured when running ec2-create-snapshot. The error returned is below:\n$ec2_create_snapshot_result" 1>&2 ; exit 70 else - ec2_snapshot_resource_id=$(echo "$ec2_create_snapshot_result" | cut -f 4) + ec2_snapshot_resource_id=$(echo "$ec2_create_snapshot_result" | cut -f 5) fi create_EBS_Snapshot_Tags done