diff options
Diffstat (limited to 'src/main/scripts')
-rw-r--r-- | src/main/scripts/appController.sh | 23 | ||||
-rw-r--r-- | src/main/scripts/configurationPoller.sh | 46 | ||||
-rw-r--r-- | src/main/scripts/docker-entry.sh | 3 |
3 files changed, 1 insertions, 71 deletions
diff --git a/src/main/scripts/appController.sh b/src/main/scripts/appController.sh index d141addf..97556c4c 100644 --- a/src/main/scripts/appController.sh +++ b/src/main/scripts/appController.sh @@ -1,5 +1,4 @@ #!/bin/bash - ### # ============LICENSE_START======================================================= # PROJECT @@ -22,26 +21,6 @@ ### source bin/logger.sh -updateKeystore() { - log "Updating keystore configuration" - aliasParameterName="collector.keystore.alias" - originalPropertyFile="etc/collector.properties" - temporaryPropertyFile="etc/collector.properties.tmp" - keystorePath=`grep collector.keystore.file.location ${originalPropertyFile} | tr -d '[:space:]' | cut -d"=" -f2` - keystorePasswordFile=`grep collector.keystore.passwordfile ${originalPropertyFile} | tr -d '[:space:]' | cut -d"=" -f2` - temporaryAlias=`/usr/bin/keytool -list -keystore $keystorePath < $keystorePasswordFile | grep "PrivateKeyEntry" | cut -d"," -f1` - newAlias=`echo $temporaryAlias | cut -d":" -f2` - sed "s~$aliasParameterName=.*~$aliasParameterName=$newAlias~g" ${originalPropertyFile} > ${temporaryPropertyFile} - echo `cat ${temporaryPropertyFile} > ${originalPropertyFile}` - rm ${temporaryPropertyFile} - log "Keystore configuration updated" -} - -tryToPollConfiguration() { - log "Trying to poll configuration from CBS before application starts" - ${JAVA_HOME}/bin/java -cp "etc:lib/*" org.onap.dcae.controller.PreAppStartupConfigUpdater -} - start() { log "Starting application" appPids=`pidof java` @@ -78,7 +57,7 @@ stop() { } case $1 in - "start") tryToPollConfiguration; updateKeystore; start ;; + "start") start ;; "stop") stop ;; "restart") stop; start ;; *) echo "Bad usage. Should be: /bin/bash <this> start/stop" diff --git a/src/main/scripts/configurationPoller.sh b/src/main/scripts/configurationPoller.sh deleted file mode 100644 index 59dbf840..00000000 --- a/src/main/scripts/configurationPoller.sh +++ /dev/null @@ -1,46 +0,0 @@ -#!/bin/bash -### -# ============LICENSE_START======================================================= -# PROJECT -# ================================================================================ -# Copyright (C) 2018 AT&T Intellectual Property. All rights reserved. -# ================================================================================ -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# ============LICENSE_END========================================================= -### -source bin/logger.sh - -# This scripts job is to continuously run in background and watch for changes in collector.properties -# and in case it has changed, restart application. -# collector.properties (and DmaapConfig.json) is being updated periodically by calling for configuration from CBS and it is -# done inside the VESCollector application itself. -# Configuration poller can be run regardless of deployment type. -# It will always check for changes in collector.properties and in deployment scenario, -# where dynamic configuration should not be used, necessary environment -# variables that are needed (consul host, cbs name, app name) will be missing, and java app will -# not update the configuration files so restart won't be triggered. - -# Start after a while, because once the application starts, it might happen that -# it fetched new configuration. In that case, the application will already be started with newest config, there would -# be no point in restarting it once again. -sleep 2m - -while true -do - sleep 1m - if [[ $(find etc/collector.properties -mmin -1 -print) ]]; then - log "Found change in collector.properties, updating keystore and restarting application" - bin/appController.sh restart - fi -done - diff --git a/src/main/scripts/docker-entry.sh b/src/main/scripts/docker-entry.sh index c17dd958..6b300669 100644 --- a/src/main/scripts/docker-entry.sh +++ b/src/main/scripts/docker-entry.sh @@ -57,7 +57,4 @@ log "Scheduling application to be started, looping indefinitely to hold the dock bin/appController.sh stop bin/appController.sh start & -log "Enabling configuration polling from CBS" -bin/configurationPoller.sh & - while true; do sleep 1000; done |