-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathrun.sh
More file actions
executable file
·119 lines (96 loc) · 2.94 KB
/
Copy pathrun.sh
File metadata and controls
executable file
·119 lines (96 loc) · 2.94 KB
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
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
#!/bin/bash
set -u
__bash_dir__="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
# SKIP_SDC_SOURCE_TEST="${SKIP_SDC_SOURCE_TEST:-false}"
SKIP_BUILD_LIB="${SKIP_BUILD_LIB:-false}"
SKIP_RUN_SDC=${SKIP_RUN_SDC:-false}
DEV_MODE="${DEV_MODE:-true}"
TAP_DATA_VERSION=tapdata-1.2.1
export TAP_DATA_VERSION
PID=$(ps -ef|grep tapdata|grep -v grep|awk '{print $2}')
echo 'TAPDATA PID:'$PID
make_dist_dir() {
if [ ! -d "${__bash_dir__}/dist/" ]; then
mkdir "${__bash_dir__}/dist"
fi
if [ ! -d "${__bash_dir__}/dist/target" ]; then
mkdir "${__bash_dir__}/dist/target"
fi
if [ ! -d "${__bash_dir__}/dist/target/${TAP_DATA_VERSION}" ]; then
mkdir "${__bash_dir__}/dist/target/${TAP_DATA_VERSION}"
fi
}
download_sdc() {
echo "start to download sdc core"
export SDC_VERSION="3.2.0.0-SNAPSHOT"
cd "${__bash_dir__}/dist"
if [ ! -f "${__bash_dir__}/dist/streamsets-datacollector-core-${SDC_VERSION}.tgz" ]; then
curl -O http://nightly.streamsets.com.s3-us-west-2.amazonaws.com/datacollector/latest/tarball/streamsets-datacollector-core-${SDC_VERSION}.tgz
fi
rm -rf "${__bash_dir__}/dist/target/${TAP_DATA_VERSION}"
tar -xvf streamsets-datacollector-core-${SDC_VERSION}.tgz &> /dev/null
mv streamsets-datacollector-${SDC_VERSION} "${__bash_dir__}/dist/target/${TAP_DATA_VERSION}"
rm -rf "target/${TAP_DATA_VERSION}/sdc-static-web"
cd "${__bash_dir__}"
}
install_ui_lib() {
cd "${__bash_dir__}/datacollector-ui"
if hash yarn 2>/dev/null; then
yarn install
yarn global add bower
yarn global add grunt-cli
bower install --allow-root
else
echo 'please install yarn for build environment.'
exit 1;
fi
}
build_ui() {
echo "start to build html"
cd "${__bash_dir__}/datacollector-ui"
grunt build --force
}
watch_ui() {
echo "start to grunt watch"
cd "${__bash_dir__}/datacollector-ui"
grunt watch --force
}
run_sdc() {
#echo "start to check sdc download"
#download_sdc
echo "start to run sdc"
cd "${__bash_dir__}"/dist/target/"$TAP_DATA_VERSION"
export SDC_FILE_LIMIT=1024
# dist/sdc/bin/streamsets dc
# BUILD_ID=dontKillMe nohup dist/sdc/bin/streamsets dc &
BUILD_ID=dontKillMe nohup ./bin/streamsets dc>log/nohup 2>&1 &
}
main () {
make_dist_dir
# if [ "$SKIP_SDC_SOURCE_TEST" != "true" ]; then
# download_sdc
# fi
if [ "$SKIP_BUILD_LIB" != "true" ]; then
install_ui_lib
fi
if [ "$DEV_MODE" = "true" ]; then
watch_ui
else
build_ui
echo "Done: built dist html files in ./dist/target/${TAP_DATA_VERSION}"
fi
if [ "$SKIP_RUN_SDC" = "false" ]; then
#kill $(lsof -t -i:18630)
if [ "$PID" != "" ]; then
echo 'KILL TAPDATA'
kill -9 $PID
else
echo 'TAPDATA IS NOT RUNNING'
fi
echo 'starting sdc'
run_sdc
else
echo 'not starting sdc'
fi
}
main "$@"