-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathabstat.sh
executable file
·85 lines (73 loc) · 1.33 KB
/
abstat.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
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
#!/bin/bash
function as_absolute(){
echo `cd $1; pwd`
}
function start(){
default_port=80:80
if [[ $1 == --backend ]]
then
default_port=8885:80
fi
$docker_command -d -p $default_port -p 8880:8880 -p 8881:8881 -p 8882:8882 --name abstat $hosts $abstat --live-forever
}
function destroy(){
if [[ $(docker ps | grep abstat) ]]
then
docker stop abstat
fi
docker rm -f $(docker ps -aq)
}
function build(){
docker build --rm -t abstat deployment
run_command --dry ./build.sh
run_command --dry chmod 775 -R data/
run_command --dry chmod 777 -R summarization/bin
}
function run_command(){
$docker_command -it $hosts $abstat $@
}
function exec_command(){
docker exec -it abstat $@
}
function status(){
set +e
docker inspect abstat
docker ps -a | grep -B 1 abstat
set -e
}
function log(){
docker logs abstat
}
set -e
current_directory=$(as_absolute `dirname $0`)
docker_command="docker run -v $current_directory:/schema-summaries"
abstat=abstat
case "$1" in
start)
shift
start $1
;;
destroy)
destroy
;;
build)
build
;;
exec)
shift
exec_command $@
;;
run)
shift
run_command $@
;;
status)
status
;;
log)
log
;;
*)
echo "Usage: abstat start | destroy | build | exec | run | status | log"
;;
esac