From 85a3f9f46515bef223aab2bb5877e488433e0d99 Mon Sep 17 00:00:00 2001 From: lb584 <lb584@cam.ac.uk> Date: Fri, 19 May 2023 15:45:23 +0100 Subject: [PATCH] modifying docker launch script to pass through optional args from command line --- configs/docker/run/runDockerEWS.sh | 37 +++++++++++++++++++----------- 1 file changed, 24 insertions(+), 13 deletions(-) diff --git a/configs/docker/run/runDockerEWS.sh b/configs/docker/run/runDockerEWS.sh index 3b1d54f..c293d67 100755 --- a/configs/docker/run/runDockerEWS.sh +++ b/configs/docker/run/runDockerEWS.sh @@ -1,16 +1,16 @@ #!/bin/bash set -e -upload='' -islive='--islive' -clearup='--clearup' +component='not_set' config='/storage/app/EWS_prod/regions/EastAfrica/resources/coordinator/configs/config_EastAfrica_fc_live.json' # default rundate=$(date '+%Y%m%d') # default today +optionalArgs="" -SHORT=p:,c:,s:,h -LONG=component:,config:,rundate::,help -OPTS=$(getopt -a -n weather --options $SHORT --longoptions $LONG -- "$@") +SHORT=p:c:s:h +LONG=component:,config:,rundate:,noupload::,islive::,clearup::,help +OPTS=$(getopt -a --options $SHORT --longoptions $LONG -- "$@") +echo $OPTS eval set -- "$OPTS" while : @@ -28,6 +28,18 @@ do rundate="$2" shift 2 ;; + --noupload ) + optionalArgs="$optionalArgs --noupload" + shift 2; + ;; + --islive ) + optionalArgs="$optionalArgs --islive" + shift 2; + ;; + --clearup ) + optionalArgs="$optionalArgs --clearup" + shift 2; + ;; -h | --help) "This is a launch script, example usage: runDockerEWS.sh -p Deposition -c -c /<path>/config_EastAfrica_fc_live.json -s 20220808" exit 2 @@ -45,17 +57,16 @@ done function run_coordinator() { - printf "component: %s\nconfig: %s\nrundate: %s\nupload: %s\n" $component $config $rundate $upload; + printf "component: %s\nconfig: %s\nrundate: %s\n" "$component" "$config" "$rundate" + printf "optional args:\n%s\n" "$optionalArgs" docker container ls; docker exec \ ews_runner \ /storage/app/EWS_prod/code/coordinator/scripts/run_Processor.sh \ - -p $component \ - -c $config \ - -s $rundate \ - $upload \ - $islive \ - $clearup + -p "$component" \ + -c "$config" \ + -s "$rundate" \ + "$optionalArgs" } run_coordinator -- GitLab