blob: c991d07f844facf196bd6e39f9997cc3d28c447c (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
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
|