blob: c61c3003ae79251c5f5a4f0722eb9c95d21994e9 [file] [log] [blame]
Lusheng Jid6d409f2018-03-22 23:25:45 -04001#!/bin/bash
2# ================================================================================
Vijay Venkatesh Kumar290fe202019-04-24 12:49:48 +00003# Copyright (c) 2018-2019 AT&T Intellectual Property. All rights reserved.
Lusheng Jid6d409f2018-03-22 23:25:45 -04004# ================================================================================
5# Licensed under the Apache License, Version 2.0 (the "License");
6# you may not use this file except in compliance with the License.
7# You may obtain a copy of the License at
8#
9# http://www.apache.org/licenses/LICENSE-2.0
10#
11# Unless required by applicable law or agreed to in writing, software
12# distributed under the License is distributed on an "AS IS" BASIS,
13# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14# See the License for the specific language governing permissions and
15# limitations under the License.
16# ============LICENSE_END=========================================================
17
18set -e
19
20CDAP_HOST='localhost'
21CDAP_PORT='11015'
22TCA_NAMESPACE='cdap_tca_hi_lo'
23TCA_APPNAME='dcae-tca'
24
25TCA_ARTIFACT='dcae-analytics-cdap-tca'
Lusheng Jid6d409f2018-03-22 23:25:45 -040026TCA_FILE_PATH='/opt/tca'
Lusheng Ji1dd7a992018-05-10 23:54:18 -040027TCA_JAR="$(ls -1r ${TCA_FILE_PATH}/${TCA_ARTIFACT}*.jar | head -1)"
28TCA_ARTIFACT_VERSION=$(echo "$TCA_JAR" |rev |cut -f 2-4 -d '.' |rev)
Lusheng Jid6d409f2018-03-22 23:25:45 -040029TCA_APP_CONF="${TCA_FILE_PATH}/tca_app_config.json"
30TCA_CONF="${TCA_FILE_PATH}/tca_config.json"
31TCA_PREF="${TCA_FILE_PATH}/tca_app_preferences.json"
32TCA_CONF_TEMP='/tmp/tca_config.json'
33TCA_APP_CONF_TEMP='/tmp/tca_app_config.json'
34TCA_PREF_TEMP='/tmp/tca_preferences.json'
35
36TCA_PATH_APP="${CDAP_HOST}:${CDAP_PORT}/v3/namespaces/${TCA_NAMESPACE}/apps/${TCA_APPNAME}"
37TCA_PATH_ARTIFACT="${CDAP_HOST}:${CDAP_PORT}/v3/namespaces/${TCA_NAMESPACE}/artifacts"
38
Lusheng Jie380f6b2018-05-14 22:45:56 -040039MR_WATCHDOG_PATH="${TCA_FILE_PATH}/mr-watchdog.sh"
40
41
42WORKER_COUNT='0'
Lusheng Jid6d409f2018-03-22 23:25:45 -040043
Lusheng Ji1dd7a992018-05-10 23:54:18 -040044CONSUL_HOST=${CONSUL_HOST:-consul}
45CONSUL_PORT=${CONSUL_PORT:-8500}
Lusheng Ji3622f7a2018-04-04 21:51:34 -040046CONFIG_BINDING_SERVICE=${CONFIG_BINDING_SERVICE:-config_binding_service}
47
48CBS_SERVICE_NAME=${CONFIG_BINDING_SERVICE}
49
vagrant61c202d2018-04-05 20:34:40 +000050#Changing to HOSTNAME parameter for consistency with k8s deploy
51MY_NAME=${HOSTNAME:-tca}
Lusheng Ji3622f7a2018-04-04 21:51:34 -040052
Lusheng Ji3622f7a2018-04-04 21:51:34 -040053
54echo "Generting preference file"
Lusheng Jie380f6b2018-05-14 22:45:56 -040055DMAAPSUBGROUP=${DMAAPSUBGROUP:-OpenDCAEc12}
56DMAAPSUBID=${DMAAPSUBID:=c12}
Lusheng Ji3622f7a2018-04-04 21:51:34 -040057sed -i 's/{{DMAAPHOST}}/'"${DMAAPHOST}"'/g' ${TCA_PREF}
58sed -i 's/{{DMAAPPORT}}/'"${DMAAPPORT}"'/g' ${TCA_PREF}
59sed -i 's/{{DMAAPPUBTOPIC}}/'"${DMAAPPUBTOPIC}"'/g' ${TCA_PREF}
60sed -i 's/{{DMAAPSUBTOPIC}}/'"${DMAAPSUBTOPIC}"'/g' ${TCA_PREF}
Lusheng Jie380f6b2018-05-14 22:45:56 -040061sed -i 's/{{DMAAPSUBGROUP}}/'"${DMAAPSUBGROUP}"'/g' ${TCA_PREF}
62sed -i 's/{{DMAAPSUBID}}/'"${DMAAPSUBID}"'/g' ${TCA_PREF}
Lusheng Ji3622f7a2018-04-04 21:51:34 -040063sed -i 's/{{AAIHOST}}/'"${AAIHOST}"'/g' ${TCA_PREF}
64sed -i 's/{{AAIPORT}}/'"${AAIPORT}"'/g' ${TCA_PREF}
Lusheng Ji1dd7a992018-05-10 23:54:18 -040065if [ -z "$REDISHOSTPORT" ]; then
Lusheng Ji3622f7a2018-04-04 21:51:34 -040066 sed -i 's/{{REDISHOSTPORT}}/NONE/g' ${TCA_PREF}
67 sed -i 's/{{REDISCACHING}}/false/g' ${TCA_PREF}
68else
69 sed -i 's/{{REDISHOSTPORT}}/'"${REDISHOSTPORT}"'/g' ${TCA_PREF}
70 sed -i 's/{{REDISCACHING}}/true/g' ${TCA_PREF}
71fi
Lusheng Jid6d409f2018-03-22 23:25:45 -040072
73function tca_stop {
74 # stop programs
75 echo
76 echo "Stopping TCADMaaPMRPublisherWorker, TCADMaaPMRSubscriberWorker, and TCAVESCollectorFlow ..."
77 echo
78 curl -s -X POST "http://${TCA_PATH_APP}/workers/TCADMaaPMRPublisherWorker/stop"
79 curl -s -X POST "http://${TCA_PATH_APP}/workers/TCADMaaPMRSubscriberWorker/stop"
80 curl -s -X POST "http://${TCA_PATH_APP}/flows/TCAVESCollectorFlow/stop"
81 echo "done"
82 echo
83}
84
85function tca_load_artifact {
86 echo
Lusheng Ji3622f7a2018-04-04 21:51:34 -040087 echo "Loading artifact ${TCA_JAR} to http://${TCA_PATH_ARTIFACT}/${TCA_ARTIFACT}..."
Lusheng Jid6d409f2018-03-22 23:25:45 -040088 curl -s -X POST --data-binary @"${TCA_JAR}" "http://${TCA_PATH_ARTIFACT}/${TCA_ARTIFACT}"
89 echo
90}
91
92function tca_load_conf {
93 echo
Lusheng Ji3622f7a2018-04-04 21:51:34 -040094 echo "Loading configuration ${TCA_APP_CONF} to http://${TCA_PATH_APP}"
Lusheng Jid6d409f2018-03-22 23:25:45 -040095 curl -s -X PUT -d @${TCA_APP_CONF} http://${TCA_PATH_APP}
96 echo
97
98 # load preferences
99 echo
Lusheng Ji3622f7a2018-04-04 21:51:34 -0400100 echo "Loading preferences ${TCA_PREF} to http://${TCA_PATH_APP}/preferences"
Lusheng Jid6d409f2018-03-22 23:25:45 -0400101 curl -s -X PUT -d @${TCA_PREF} http://${TCA_PATH_APP}/preferences
102 echo
103}
104
105
106function tca_delete {
107 echo
Lusheng Ji3622f7a2018-04-04 21:51:34 -0400108 echo "Deleting application dcae-tca http://${TCA_PATH_APP}"
Lusheng Jid6d409f2018-03-22 23:25:45 -0400109 curl -s -X DELETE http://${TCA_PATH_APP}
110 echo
111
112 # delete artifact
113 echo
Lusheng Ji3622f7a2018-04-04 21:51:34 -0400114 echo "Deleting artifact http://${TCA_PATH_ARTIFACT}/${TCA_ARTIFACT}/versions/${TCA_ARTIFACT_VERSION} ..."
Lusheng Jid6d409f2018-03-22 23:25:45 -0400115 curl -s -X DELETE "http://${TCA_PATH_ARTIFACT}/${TCA_ARTIFACT}/versions/${TCA_ARTIFACT_VERSION}"
116 echo
117}
118
119function tca_start {
120 echo
121 echo "Starting TCADMaaPMRPublisherWorker, TCADMaaPMRSubscriberWorker, and TCAVESCollectorFlow ..."
122 curl -s -X POST "http://${TCA_PATH_APP}/workers/TCADMaaPMRPublisherWorker/start"
123 curl -s -X POST "http://${TCA_PATH_APP}/workers/TCADMaaPMRSubscriberWorker/start"
124 curl -s -X POST "http://${TCA_PATH_APP}/flows/TCAVESCollectorFlow/start"
125 echo
126}
127
128
129function tca_status {
Lusheng Jie380f6b2018-05-14 22:45:56 -0400130 WORKER_COUNT='0'
Lusheng Jid6d409f2018-03-22 23:25:45 -0400131 echo
Lusheng Jie380f6b2018-05-14 22:45:56 -0400132 STATUS=$(curl -s "http://${TCA_PATH_APP}/workers/TCADMaaPMRPublisherWorker/status")
133 echo "TCADMaaPMRPublisherWorker status: $STATUS"
134 INC=$(echo "$STATUS" | jq . |grep RUNNING |wc -l)
135 WORKER_COUNT=$((WORKER_COUNT+INC))
136
137 STATUS=$(curl -s "http://${TCA_PATH_APP}/workers/TCADMaaPMRSubscriberWorker/status")
138 echo "TCADMaaPMRSubscriberWorker status: $STATUS"
139 INC=$(echo "$STATUS" | jq . |grep RUNNING |wc -l)
140 WORKER_COUNT=$((WORKER_COUNT+INC))
141
142 STATUS=$(curl -s "http://${TCA_PATH_APP}/flows/TCAVESCollectorFlow/status")
143 echo "TCAVESCollectorFlow status: $STATUS"
144 INC=$(echo "$STATUS" | jq . |grep RUNNING |wc -l)
145 WORKER_COUNT=$((WORKER_COUNT+INC))
Lusheng Jid6d409f2018-03-22 23:25:45 -0400146 echo
Lusheng Jid6d409f2018-03-22 23:25:45 -0400147}
148
149
Lusheng Jie380f6b2018-05-14 22:45:56 -0400150function tca_restart {
151 MR_HOST=$(jq .subscriberHostName ${TCA_PREF} |sed -e 's/\"//g')
152 MR_PORT=$(jq .subscriberHostPort ${TCA_PREF} |sed -e 's/\"//g')
153 MR_TOPIC=$(jq .subscriberTopicName ${TCA_PREF} |sed -e 's/\"//g')
154 echo "Verifying DMaaP topic: ${MR_TOPIC}@${MR_HOST}:${MR_PORT} (will block until topic ready)"
155 "${MR_WATCHDOG_PATH}" "${MR_HOST}" "${MR_PORT}" "${MR_TOPIC}"
156 tca_stop
157 tca_delete
158 tca_load_artifact
159 tca_load_conf
160 tca_start
161 sleep 5
162 tca_status
163}
164
Lusheng Jid6d409f2018-03-22 23:25:45 -0400165function tca_poll_policy {
Lusheng Jie134c822018-04-23 23:16:32 -0400166 URL0="${CBS_HOST}:${CBS_PORT}/service_component_all/${MY_NAME}"
Lusheng Ji1dd7a992018-05-10 23:54:18 -0400167 echo "tca_poll_policy: Retrieving all-in-one config at ${URL0}"
Lusheng Jie134c822018-04-23 23:16:32 -0400168 HTTP_RESPONSE=$(curl --silent --write-out "HTTPSTATUS:%{http_code}" "$URL0")
Lusheng Ji1dd7a992018-05-10 23:54:18 -0400169 HTTP_BODY=$(echo "$HTTP_RESPONSE" | sed -e 's/HTTPSTATUS\:.*//g')
170 HTTP_STATUS=$(echo "$HTTP_RESPONSE" | tr -d '\n' | sed -e 's/.*HTTPSTATUS://')
Lusheng Jiac864ce2018-04-05 12:02:52 -0400171
Lusheng Jiac864ce2018-04-05 12:02:52 -0400172 if [ "$HTTP_STATUS" != "200" ]; then
Lusheng Ji1dd7a992018-05-10 23:54:18 -0400173 echo "tca_poll_policy: Retrieving all-in-one config failed with status $HTTP_STATUS"
Lusheng Jie134c822018-04-23 23:16:32 -0400174 URL1="${CBS_HOST}:${CBS_PORT}/service_component/${MY_NAME}"
Lusheng Ji1dd7a992018-05-10 23:54:18 -0400175 echo "tca_poll_policy: Retrieving app config only at ${URL1}"
Lusheng Jie134c822018-04-23 23:16:32 -0400176 HTTP_RESPONSE1=$(curl --silent --write-out "HTTPSTATUS:%{http_code}" "$URL1")
Lusheng Ji1dd7a992018-05-10 23:54:18 -0400177 HTTP_BODY1=$(echo "$HTTP_RESPONSE1" | sed -e 's/HTTPSTATUS\:.*//g')
178 HTTP_STATUS1=$(echo "$HTTP_RESPONSE1" | tr -d '\n' | sed -e 's/.*HTTPSTATUS://')
Lusheng Jie134c822018-04-23 23:16:32 -0400179 if [ "$HTTP_STATUS1" != "200" ]; then
Lusheng Ji1dd7a992018-05-10 23:54:18 -0400180 echo "tca_poll_policy: Retrieving app config only failed with status $HTTP_STATUS1"
Lusheng Jie134c822018-04-23 23:16:32 -0400181 return
182 fi
183
184 URL2="$URL1:preferences"
Lusheng Ji1dd7a992018-05-10 23:54:18 -0400185 echo "tca_poll_policy: Retrieving app preferences only at ${URL2}"
Lusheng Jie134c822018-04-23 23:16:32 -0400186 HTTP_RESPONSE2=$(curl --silent --write-out "HTTPSTATUS:%{http_code}" "$URL2")
Lusheng Ji1dd7a992018-05-10 23:54:18 -0400187 HTTP_BODY2=$(echo "$HTTP_RESPONSE2" | sed -e 's/HTTPSTATUS\:.*//g')
188 HTTP_STATUS2=$(echo "$HTTP_RESPONSE2" | tr -d '\n' | sed -e 's/.*HTTPSTATUS://')
Lusheng Jie134c822018-04-23 23:16:32 -0400189 if [ "$HTTP_STATUS2" != "200" ]; then
Lusheng Ji1dd7a992018-05-10 23:54:18 -0400190 echo "tca_poll_policy: Retrieving app preferences only failed with status $HTTP_STATUS2"
191 return
192 fi
193
194 if [[ "$CONFIG" == "null" || "$PREF" == "null" ]]; then
195 echo "tca_poll_policy: either app config or app preferences being empty, config not applicable"
Lusheng Jie134c822018-04-23 23:16:32 -0400196 return
197 fi
198
Lusheng Ji1dd7a992018-05-10 23:54:18 -0400199 echo "$HTTP_BODY1" | jq . --sort-keys > "${TCA_CONF_TEMP}"
200 echo "$HTTP_BODY2" | jq . --sort-keys > "${TCA_PREF_TEMP}"
Lusheng Jie134c822018-04-23 23:16:32 -0400201 else
Lusheng Ji1dd7a992018-05-10 23:54:18 -0400202 CONFIG=$(echo "$HTTP_BODY" | jq .config.app_config)
203 PREF=$(echo "$HTTP_BODY" | jq .config.app_preferences)
Vijay Venkatesh Kumar290fe202019-04-24 12:49:48 +0000204 POLICY=$(echo "$HTTP_BODY" | jq .policies.items[0].config.tca_policy)
vagrantb51fd792018-05-01 08:21:11 +0000205
vagrantb51fd792018-05-01 08:21:11 +0000206
Lusheng Ji1dd7a992018-05-10 23:54:18 -0400207 if [[ "$CONFIG" == "null" || "$PREF" == "null" ]]; then
208 echo "tca_poll_policy: CONFIG received is parsed to be empty, trying to parse using R1 format"
209 CONFIG=$(echo "$HTTP_BODY" | jq .config)
210 NEWPREF=$(echo "$HTTP_BODY" | jq .preferences)
211
212 #echo "CONFIG is [$CONFIG]"
213 #echo "NEWPREF is [$NEWPREF]"
vagrantb51fd792018-05-01 08:21:11 +0000214 else
Lusheng Ji1dd7a992018-05-10 23:54:18 -0400215 echo "tca_poll_policy: CONFIG is [${CONFIG}], PREF is [${PREF}], POLICY is [${POLICY}]"
216 ## Check if policy content under tca_policy is returned null
217 ## null indicates no active policy flow; hence use configuration loaded
218 ## from blueprint
219 if [ "$POLICY" == "null" ]; then
220 # tca_policy through blueprint
221 NEWPREF=${PREF}
222 else
223 # tca_policy through active policy flow through PH
224 NEWPREF=$(echo "$PREF" | jq --arg tca_policy "$POLICY" '. + {$tca_policy}')
225 fi
226 NEWPREF=$(echo "$NEWPREF" | sed 's/\\n//g')
vagrantb51fd792018-05-01 08:21:11 +0000227 fi
Lusheng Ji1dd7a992018-05-10 23:54:18 -0400228
229 if [[ "$CONFIG" == "null" || "$NEWPREF" == "null" ]]; then
230 echo "tca_poll_policy: either app config or app preferences being empty, config not applicable"
231 return
232 fi
233
234 echo "$CONFIG" | jq . --sort-keys > "${TCA_CONF_TEMP}"
235 echo "$NEWPREF" | jq . --sort-keys > "${TCA_PREF_TEMP}"
Lusheng Jiac864ce2018-04-05 12:02:52 -0400236 fi
Lusheng Jid6d409f2018-03-22 23:25:45 -0400237
238 if [ ! -e "${TCA_CONF_TEMP}" ] || [ "$(ls -sh ${TCA_CONF_TEMP} |cut -f1 -d' ' |sed -e 's/[^0-9]//g')" -lt "1" ]; then
239 echo "Fail to receive configuration"
240 return
241 fi
242 if [ ! -e "${TCA_PREF_TEMP}" ] || [ "$(ls -sh ${TCA_PREF_TEMP} |cut -f1 -d' ' |sed -e 's/[^0-9]//g')" -lt "1" ]; then
243 echo "Fail to receive preferences"
244 return
245 fi
246
247 CONF_CHANGED=""
248 # extract only the config section from APP CONF (which has both artifact and config sections)
249 jq .config --sort-keys ${TCA_APP_CONF} > ${TCA_CONF}
250 if ! diff ${TCA_CONF} ${TCA_CONF_TEMP} ; then
251 echo "TCA config changed"
252 # generating the new app conf using current app conf's artifact section and the new downloaded config
253 jq --argfile CONFVALUE ${TCA_CONF_TEMP} '.config = $CONFVALUE' <${TCA_APP_CONF} > ${TCA_APP_CONF_TEMP}
254
255 mv ${TCA_APP_CONF_TEMP} ${TCA_APP_CONF}
256 CONF_CHANGED=1
257 fi
258
259 PERF_CHANGED=""
260 # update the subscriber ConsumerID, if not already unique,
261 # so replicas appear as different consumers in the consumer group
262 HOSTID=$(head -1 /etc/hostname | rev |cut -f1-2 -d'-' |rev)
263 CONSUMERID=$(jq .subscriberConsumerId ${TCA_PREF_TEMP} |sed -e 's/\"//g')
264 if ! (echo "$CONSUMERID" |grep "$HOSTID"); then
265 CONSUMERID="${CONSUMERID}-${HOSTID}"
Lusheng Ji1dd7a992018-05-10 23:54:18 -0400266 jq --arg CID "${CONSUMERID}" '.subscriberConsumerId = $CID' < "${TCA_PREF_TEMP}" > "${TCA_PREF_TEMP}2"
Lusheng Jid6d409f2018-03-22 23:25:45 -0400267 mv "${TCA_PREF_TEMP}2" "${TCA_PREF_TEMP}"
268 fi
269 if ! diff ${TCA_PREF} ${TCA_PREF_TEMP} ; then
270 echo "TCA preference updated"
271 mv ${TCA_PREF_TEMP} ${TCA_PREF}
272 PERF_CHANGED=1
273 fi
274
Lusheng Ji1dd7a992018-05-10 23:54:18 -0400275 if [[ "$PERF_CHANGED" == "1" || "$CONF_CHANGED" == "1" ]]; then
276 echo "Newly received configuration/preference differ from the running instance's. reload confg"
Lusheng Jie380f6b2018-05-14 22:45:56 -0400277 tca_restart
278 else
279 echo "Newly received configuration/preference identical from the running instance's"
Lusheng Jid6d409f2018-03-22 23:25:45 -0400280 fi
281}
282
283
284export PATH=${PATH}:/opt/cdap/sdk/bin
285
Lusheng Ji1dd7a992018-05-10 23:54:18 -0400286
287echo "Starting TCA-CDAP in standalone mode"
288
Lusheng Jid6d409f2018-03-22 23:25:45 -0400289# starting CDAP SDK in background
290cdap sdk start
291
Lusheng Jie380f6b2018-05-14 22:45:56 -0400292echo "CDAP Started, waiting CDAP ready on ${CDAP_HOST}:${CDAP_PORT} ..."
Lusheng Jid6d409f2018-03-22 23:25:45 -0400293while ! nc -z ${CDAP_HOST} ${CDAP_PORT}; do
Lusheng Jie380f6b2018-05-14 22:45:56 -0400294 sleep 1 # wait for 1 second before check again
Lusheng Jid6d409f2018-03-22 23:25:45 -0400295done
Lusheng Jid6d409f2018-03-22 23:25:45 -0400296
297echo "Creating namespace cdap_tca_hi_lo ..."
298curl -s -X PUT "http://${CDAP_HOST}:${CDAP_PORT}/v3/namespaces/cdap_tca_hi_lo"
299
Lusheng Jid6d409f2018-03-22 23:25:45 -0400300# stop programs
301tca_stop
Lusheng Jid6d409f2018-03-22 23:25:45 -0400302# delete application
303tca_delete
Lusheng Jid6d409f2018-03-22 23:25:45 -0400304# load artifact
305tca_load_artifact
306tca_load_conf
Lusheng Jid6d409f2018-03-22 23:25:45 -0400307# start programs
308tca_start
309
Lusheng Jid6d409f2018-03-22 23:25:45 -0400310# get status of programs
311tca_status
312
Lusheng Jie380f6b2018-05-14 22:45:56 -0400313echo "TCA-CDAP standalone mode initialization completed, with $WORKER_COUNT / 3 up"
Lusheng Jid6d409f2018-03-22 23:25:45 -0400314
315
Lusheng Ji1dd7a992018-05-10 23:54:18 -0400316
317#Changing to HOSTNAME parameter for consistency with k8s deploy
318MY_NAME=${HOSTNAME:-tca}
319
320unset CBS_HOST
321unset CBS_PORT
322echo "TCA environment: I am ${MY_NAME}, consul at ${CONSUL_HOST}:${CONSUL_PORT}, CBS service name ${CBS_SERVICE_NAME}"
323
324while echo
Lusheng Jid6d409f2018-03-22 23:25:45 -0400325do
Lusheng Jie380f6b2018-05-14 22:45:56 -0400326 echo "======================================================> $(date)"
327 tca_status
328
329 while [ "$WORKER_COUNT" != "3" ]; do
330 echo "Status checking: worker count is $WORKER_COUNT, needs a reset"
331 sleep 5
332
333 tca_restart
334 echo "TCA restarted"
335 done
336
337
Lusheng Ji1dd7a992018-05-10 23:54:18 -0400338 if [[ -z "$CBS_HOST" || -z "$CBS_PORT" ]]; then
339 echo "Retrieving host and port for ${CBS_SERVICE_NAME} from ${CONSUL_HOST}:${CONSUL_PORT}"
340 sleep 2
341 CBS_HOST=$(curl -s "${CONSUL_HOST}:${CONSUL_PORT}/v1/catalog/service/${CBS_SERVICE_NAME}" |jq .[0].ServiceAddress |sed -e 's/\"//g')
342 CBS_PORT=$(curl -s "${CONSUL_HOST}:${CONSUL_PORT}/v1/catalog/service/${CBS_SERVICE_NAME}" |jq .[0].ServicePort |sed -e 's/\"//g')
343 echo "CBS discovered to be at ${CBS_HOST}:${CBS_PORT}"
344 fi
345
346 if [ ! -z "$CBS_HOST" ] && [ ! -z "$CBS_PORT" ]; then
347 tca_poll_policy
348 fi
Lusheng Jid6d409f2018-03-22 23:25:45 -0400349 sleep 30
350done