diff options
author | Tschaen, Brendan (bptschaen) <bt054f@att.com> | 2018-05-25 16:01:18 -0400 |
---|---|---|
committer | Tschaen, Brendan (bptschaen) <bt054f@att.com> | 2018-05-25 16:01:18 -0400 |
commit | 4adfe22e6cc067dea88f6468efb74c3208e909bb (patch) | |
tree | 6e3a81c6b7b440f17a887583672d3b3602003da2 /distribution | |
parent | 660d3c95610fd80aef58e5c9637971efe5af22b9 (diff) |
Initial code commit
Change-Id: I9e82864d57a0633aeb6e0107084a80ab926bede8
Issue-ID: MUSIC-77
Signed-off-by: Tschaen, Brendan (bt054f) <bt054f@att.com>
Signed-off-by: Tschaen, Brendan (bptschaen) <bt054f@att.com>
Diffstat (limited to 'distribution')
-rwxr-xr-x | distribution/prom_container.sh | 55 |
1 files changed, 55 insertions, 0 deletions
diff --git a/distribution/prom_container.sh b/distribution/prom_container.sh new file mode 100755 index 0000000..c991d07 --- /dev/null +++ b/distribution/prom_container.sh @@ -0,0 +1,55 @@ +#!/bin/bash + +# ensure that the config.json is in the same location +# along with ensure active/passive scripts + + +PROM_IMG=prom +WORKING_DIR=`dirname "$(realpath $0)"` + +# +# change this location if necessary +# this is the location of the config.json and the ensure active/passive scripts +# +CONFIG_SCRIPTS_DIR=$WORKING_DIR + +usage () { + echo "Usage: $0 <start/stop> <prom id> [-p]" +} + + +if [ "$#" -lt 2 ]; then + usage + exit 1 +fi + +PROM_ID=$2 + + +PROM_PASSIVE="\"\"" +if [[ "$#" -ge 3 && ${3//[-]} == p* ]]; then + PROM_PASSIVE="-p" +fi + + + + + +echo "Starting prom, id:'$PROM_ID'" + +if [ "$1" = "start" ]; +then + docker run -d --hostname $PROM_ID \ + -e ID=$PROM_ID \ + -e PASSIVE=$PASSIVE \ + --net="host" \ + -v $CONFIG_SCRIPTS_DIR:/opt/app/prom \ + $PROM_IMG +# --name prom \ +elif [ "$1" = "stop" ]; +then + docker stop prom; + sleep 5; +else + usage +fi |