-
Notifications
You must be signed in to change notification settings - Fork 0
/
run.sh
executable file
·58 lines (51 loc) · 1.03 KB
/
run.sh
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
56
57
58
#!/bin/bash
DOCKER=false
IMAGE_VERSION=latest
PUBLISH="-p 26657"
TTY="-it"
LOG=""
usage() {
echo "syntax: $0 [options] <data_root>"
echo "options:"
echo " -d use docker with specified image version"
echo " -p publish ports 26656,26657,26660"
echo " -s keep silent, i.e. do not attach stdio"
echo " -l turn on journald log facility"
echo " -h print usage"
}
while getopts "d:pslh" arg; do
case $arg in
d)
DOCKER=true
IMAGE_VERSION=$OPTARG
;;
p)
PUBLISH="-p 26656:26656 -p 26657:26657 -p 26660:26660"
;;
s)
TTY="-d"
;;
l)
LOG="--log-driver=journald"
;;
h | *)
usage
exit
;;
esac
done
shift $(( OPTIND - 1 ))
DATAROOT=$1
if [ -z "$DATAROOT" ]; then
usage
exit
fi
echo "data root = $DATAROOT"
if [ "$DOCKER" = true ]; then
echo "docker image = $IMAGE_VERSION"
docker stop amod -t 5
docker rm amod
docker run $TTY $LOG --restart unless-stopped --name amod $PUBLISH -v $DATAROOT/amo:/amo amolabs/amod:$IMAGE_VERSION amod run --home /amo
else
amod run --home $DATAROOT/amo
fi