Merge pull request #21 from jonhiggs/master
Use $EC2_REGION if it's set.
This commit is contained in:
commit
3400220d5b
|
@ -150,7 +150,7 @@ app_name=`basename $0`
|
||||||
|
|
||||||
#sets defaults
|
#sets defaults
|
||||||
selection_method="volumeid"
|
selection_method="volumeid"
|
||||||
region="us-east-1"
|
|
||||||
#date_binary allows a user to set the "date" binary that is installed on their system and, therefore, the options that will be given to the date binary to perform date calculations
|
#date_binary allows a user to set the "date" binary that is installed on their system and, therefore, the options that will be given to the date binary to perform date calculations
|
||||||
date_binary=""
|
date_binary=""
|
||||||
|
|
||||||
|
@ -161,21 +161,20 @@ auto_tag=false
|
||||||
#sets the Purge Snapshot feature to false - this feature will eventually allow the removal of snapshots that have a "PurgeAfter" tag that is earlier than current date
|
#sets the Purge Snapshot feature to false - this feature will eventually allow the removal of snapshots that have a "PurgeAfter" tag that is earlier than current date
|
||||||
purge_snapshots=false
|
purge_snapshots=false
|
||||||
#handles options processing
|
#handles options processing
|
||||||
while getopts :s:c:r:v:t:k:pna opt
|
while getopts :s:c:r:v:t:k:pna opt; do
|
||||||
do
|
case $opt in
|
||||||
case $opt in
|
s) selection_method="$OPTARG";;
|
||||||
s) selection_method="$OPTARG";;
|
c) cron_primer="$OPTARG";;
|
||||||
c) cron_primer="$OPTARG";;
|
r) region="$OPTARG";;
|
||||||
r) region="$OPTARG";;
|
v) volumeid="$OPTARG";;
|
||||||
v) volumeid="$OPTARG";;
|
t) tag="$OPTARG";;
|
||||||
t) tag="$OPTARG";;
|
k) purge_after_days="$OPTARG";;
|
||||||
k) purge_after_days="$OPTARG";;
|
n) name_tag_create=true;;
|
||||||
n) name_tag_create=true;;
|
p) purge_snapshots=true;;
|
||||||
p) purge_snapshots=true;;
|
a) auto_tag=true;;
|
||||||
a) auto_tag=true;;
|
*) echo "Error with Options Input. Cause of failure is most likely that an unsupported parameter was passed or a parameter was passed without a corresponding option." 1>&2 ; exit 64;;
|
||||||
*) echo "Error with Options Input. Cause of failure is most likely that an unsupported parameter was passed or a parameter was passed without a corresponding option." 1>&2 ; exit 64;;
|
esac
|
||||||
esac
|
done
|
||||||
done
|
|
||||||
|
|
||||||
#sources "cron_primer" file for running under cron or other restricted environments - this file should contain the variables and environment configuration required for ec2-automate-backup to run correctly
|
#sources "cron_primer" file for running under cron or other restricted environments - this file should contain the variables and environment configuration required for ec2-automate-backup to run correctly
|
||||||
if [[ -n $cron_primer ]]
|
if [[ -n $cron_primer ]]
|
||||||
|
@ -186,6 +185,14 @@ if [[ -n $cron_primer ]]
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
if [ -z $region ]; then
|
||||||
|
if [ -z $EC2_REGION ]; then
|
||||||
|
region="us-east-1"
|
||||||
|
else
|
||||||
|
region="$EC2_REGION"
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
#calls prerequisitecheck function to ensure that all executables required for script execution are available
|
#calls prerequisitecheck function to ensure that all executables required for script execution are available
|
||||||
prerequisite_check
|
prerequisite_check
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user