You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Aug 16, 2021. It is now read-only.
Copy file name to clipboardExpand all lines: nancy_run.sh
+150-4Lines changed: 150 additions & 4 deletions
Original file line number
Diff line number
Diff line change
@@ -16,6 +16,7 @@ KEEP_ALIVE=0
16
16
VERBOSE_OUTPUT_REDIRECT=" > /dev/null"
17
17
EBS_SIZE_MULTIPLIER=15
18
18
POSTGRES_VERSION_DEFAULT=10
19
+
AWS_BLOCK_DURATION=0 # by default no time limit
19
20
20
21
#######################################
21
22
# Print an error/warning/notice message to STDERR
@@ -502,6 +503,9 @@ while [ $# -gt 0 ]; do
502
503
AWS_EBS_VOLUME_SIZE="$2";shift 2 ;;
503
504
--aws-region )
504
505
AWS_REGION="$2";shift 2 ;;
506
+
--aws-block-duration )
507
+
AWS_BLOCK_DURATION=$2;shift 2 ;;
508
+
505
509
--s3cfg-path )
506
510
S3_CFG_PATH="$2";shift 2 ;;
507
511
* )
@@ -549,6 +553,45 @@ if $DEBUG ; then
549
553
echo"AWS_EBS_VOLUME_SIZE: $AWS_EBS_VOLUME_SIZE"
550
554
fi
551
555
556
+
#######################################
557
+
# Check path to file/directory.
558
+
# Globals:
559
+
# None
560
+
# Arguments:
561
+
# (text) name of the variable holding the
562
+
# file path (starts with 'file://' or 's3://') or any string
563
+
# Returns:
564
+
# (integer) for input starting with 's3://' always returns 0
565
+
# for 'file://': 0 if file exists locally, error if it doesn't
566
+
# 1 if the input is empty,
567
+
# -1 otherwise.
568
+
#######################################
569
+
functioncheckPath() {
570
+
if [[ -z$1 ]];then
571
+
return 1
572
+
fi
573
+
eval path=\$$1
574
+
575
+
if [[ $path=~"s3://" ]];then
576
+
dbg "$1 looks like a S3 file path. Warning: Its presence will not be checked!"
577
+
return 0 # we do not actually check S3 paths at the moment
578
+
elif [[ $path=~"file://" ]];then
579
+
dbg "$1 looks like a local file path."
580
+
path=${path/file:\/\//}
581
+
if [[ -f$path ]];then
582
+
dbg "$path found."
583
+
eval"$1=\"$path\""# update original variable
584
+
return 0 # file found
585
+
else
586
+
err "File '$path' is not found locally."
587
+
exit 1
588
+
fi
589
+
else
590
+
dbg "Value of $1 is not a file path. Use its value as a content."
591
+
return -1 #
592
+
fi
593
+
}
594
+
552
595
### CLI parameters checks ###
553
596
if [[ "$RUN_ON"=="aws" ]];then
554
597
if [ !-z${CONTAINER_ID+x} ];then
@@ -569,6 +612,19 @@ if [[ "$RUN_ON" == "aws" ]]; then
569
612
err "NOTICE: AWS EC2 region not given. Will used us-east-1."
570
613
AWS_REGION='us-east-1'
571
614
fi
615
+
if [[ -z${AWS_BLOCK_DURATION+x} ]];then
616
+
err "NOTICE: Container live time duration is not given."
617
+
else
618
+
case$AWS_BLOCK_DURATIONin
619
+
0|60|120|240|300|360)
620
+
dbg "Container live time duration is $AWS_BLOCK_DURATION. "
621
+
;;
622
+
*)
623
+
err "Container live time duration (--aws-block-duration) has wrong value: $AWS_BLOCK_DURATION. Available values of AWS spot instance duration in minutes is 60, 120, 180, 240, 300, or 360)."
624
+
exit 1
625
+
;;
626
+
esac
627
+
fi
572
628
elif [[ "$RUN_ON"=="localhost" ]];then
573
629
if [[ !-z${AWS_KEYPAIR_NAME+x} ]] || [[ !-z${AWS_SSH_KEY_PATH+x} ]] ;then
574
630
err "ERROR: options '--aws-keypair-name' and '--aws-ssh-key-path' must be used with '--run-on aws'."
if [[ $output=~" Container live time duration (--aws-block-duration) has wrong value: 30. Available values of AWS spot instance duration in minutes is 60, 120, 180, 240, 300, or 360)." ]];then
0 commit comments