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
+154-8Lines changed: 154 additions & 8 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
@@ -498,6 +499,8 @@ while [ $# -gt 0 ]; do
498
499
AWS_SSH_KEY_PATH="$2";shift 2 ;;
499
500
--aws-ebs-volume-size )
500
501
AWS_EBS_VOLUME_SIZE="$2";shift 2 ;;
502
+
--aws-block-duration )
503
+
AWS_BLOCK_DURATION=$2;shift 2 ;;
501
504
502
505
--s3cfg-path )
503
506
S3_CFG_PATH="$2";shift 2 ;;
@@ -546,6 +549,45 @@ if $DEBUG ; then
546
549
echo"AWS_EBS_VOLUME_SIZE: $AWS_EBS_VOLUME_SIZE"
547
550
fi
548
551
552
+
#######################################
553
+
# Check path to file/directory.
554
+
# Globals:
555
+
# None
556
+
# Arguments:
557
+
# (text) name of the variable holding the
558
+
# file path (starts with 'file://' or 's3://') or any string
559
+
# Returns:
560
+
# (integer) for input starting with 's3://' always returns 0
561
+
# for 'file://': 0 if file exists locally, error if it doesn't
562
+
# 1 if the input is empty,
563
+
# -1 otherwise.
564
+
#######################################
565
+
functioncheckPath() {
566
+
if [[ -z$1 ]];then
567
+
return 1
568
+
fi
569
+
eval path=\$$1
570
+
571
+
if [[ $path=~"s3://" ]];then
572
+
dbg "$1 looks like a S3 file path. Warning: Its presence will not be checked!"
573
+
return 0 # we do not actually check S3 paths at the moment
574
+
elif [[ $path=~"file://" ]];then
575
+
dbg "$1 looks like a local file path."
576
+
path=${path/file:\/\//}
577
+
if [[ -f$path ]];then
578
+
dbg "$path found."
579
+
eval"$1=\"$path\""# update original variable
580
+
return 0 # file found
581
+
else
582
+
err "File '$path' is not found locally."
583
+
exit 1
584
+
fi
585
+
else
586
+
dbg "Value of $1 is not a file path. Use its value as a content."
587
+
return -1 #
588
+
fi
589
+
}
590
+
549
591
### CLI parameters checks ###
550
592
if [[ "$RUN_ON"=="aws" ]];then
551
593
if [ !-z${CONTAINER_ID+x} ];then
@@ -562,6 +604,19 @@ if [[ "$RUN_ON" == "aws" ]]; then
562
604
err "ERROR: AWS EC2 Instance type not given."
563
605
exit 1
564
606
fi
607
+
if [[ -z${AWS_BLOCK_DURATION+x} ]];then
608
+
err "NOTICE: Container live time duration is not given."
609
+
else
610
+
case$AWS_BLOCK_DURATIONin
611
+
0|60|120|240|300|360)
612
+
dbg "Container live time duration is $AWS_BLOCK_DURATION. "
613
+
;;
614
+
*)
615
+
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)."
616
+
exit 1
617
+
;;
618
+
esac
619
+
fi
565
620
elif [[ "$RUN_ON"=="localhost" ]];then
566
621
if [[ !-z${AWS_KEYPAIR_NAME+x} ]] || [[ !-z${AWS_SSH_KEY_PATH+x} ]] ;then
567
622
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