summaryrefslogtreecommitdiffstats
path: root/aai-resources/src/main/scripts/run_Migrations.sh
diff options
context:
space:
mode:
Diffstat (limited to 'aai-resources/src/main/scripts/run_Migrations.sh')
-rw-r--r--aai-resources/src/main/scripts/run_Migrations.sh81
1 files changed, 26 insertions, 55 deletions
diff --git a/aai-resources/src/main/scripts/run_Migrations.sh b/aai-resources/src/main/scripts/run_Migrations.sh
index 7f0ea08..1309094 100644
--- a/aai-resources/src/main/scripts/run_Migrations.sh
+++ b/aai-resources/src/main/scripts/run_Migrations.sh
@@ -1,4 +1,4 @@
-#!/bin/ksh
+#!/bin/sh
###
# ============LICENSE_START=======================================================
@@ -20,57 +20,28 @@
# ============LICENSE_END=========================================================
###
-echo
-echo $(date) " Starting $0"
-
-userid=$( id | cut -f2 -d"(" | cut -f1 -d")" )
-if [ "${userid}" != "aaiadmin" ]; then
- echo "You must be aaiadmin to run $0. The id used $userid."
- exit 1
-fi
-
-if [ -f "/etc/profile.d/aai.sh" ]; then
- source /etc/profile.d/aai.sh
-else
- echo "File not found: /etc/profile.d/aai.sh";
- exit
-fi
-
-JAVA=$JAVA_HOME/bin/java
-PROJECT_HOME=/opt/app/aai-resources
-
-ARGS="-c ${PROJECT_HOME}/bundleconfig/etc/appprops/titan-realtime.properties $@"
-
-for JAR in $(ls $PROJECT_HOME/extJars/*.jar)
-do
- CLASSPATH=$CLASSPATH:$JAR
-done
-
-UUID=$(uuidgen)
-
-unzip -o $PROJECT_HOME/lib/ajsc-runner-5.0.0-RC16.0.5.jar -d /tmp/ajsc-war-$UUID/ > /dev/null
-unzip -o /tmp/ajsc-war-$UUID/ajsc-war-5.0.0-RC16.0.5.war -d /tmp/ajsc-war-$UUID/ > /dev/null
-
-for JAR in $(ls /tmp/ajsc-war-$UUID/WEB-INF/lib/*.jar)
-do
- if [[ ! "$JAR" =~ .*logback-classic-.*.jar ]];
- then
- CLASSPATH=$CLASSPATH:$JAR
- fi
-done
-
-for JAR in $(ls /opt/app/swm/dme2/lib/*.jar)
-do
- CLASSPATH=$CLASSPATH:$JAR
-done
-
-for JAR in $(ls $PROJECT_HOME/lib/*.jar)
-do
- CLASSPATH=$CLASSPATH:$JAR
-done
-
-CLASSPATH=$CLASSPATH:${PROJECT_HOME}"/bundleconfig/etc/tmp-config/"
-
-$JAVA -Dhttps.protocols=TLSv1.1,TLSv1.2 -DAJSC_HOME=$PROJECT_HOME -Daai.home=$PROJECT_HOME -DBUNDLECONFIG_DIR="bundleconfig" -Dlogback.configurationFile=$PROJECT_HOME/bundleconfig/etc/appprops/migration-logback.xml -cp $CLASSPATH org.onap.aai.migration.MigrationController $ARGS
-
-rm -r /tmp/ajsc-war-$UUID/
+COMMON_ENV_PATH=$( cd "$(dirname "$0")" ; pwd -P )
+. ${COMMON_ENV_PATH}/common_functions.sh
+
+# TODO: There is a better way where you can pass in the function
+# and then let the common functions check if the function exist and invoke it
+# So this all can be templated out
+start_date;
+check_user;
+source_profile;
+
+ARGS="-c ${PROJECT_HOME}/resources/etc/appprops/titan-realtime.properties";
+
+if [ -f "$PROJECT_HOME/resources/application.properties" ]; then
+ # Get the application properties file and look for all lines
+ # starting with either jms dmaap or niws
+ # Turn them into system properties and export JAVA_PRE_OPTS so
+ # execute spring jar will get those values
+ # This is only needed since dmaap is used by run_migrations
+ JAVA_PRE_OPTS=$(egrep '^(dmaap|jms|niws)' $PROJECT_HOME/resources/application.properties | sed 's/^\(.*\)$/-D\1/g' | tr '\n' ' ');
+ export JAVA_PRE_OPTS;
+fi;
+
+execute_spring_jar org.onap.aai.migration.MigrationController ${PROJECT_HOME}/resources/etc/appprops/migration-logback.xml ${ARGS} "$@"
+end_date;
+exit 0