3 # ============LICENSE_START=======================================================
4 # Copyright (C) 2019-2020 Nordix Foundation.
5 # Modifications Copyright (C) 2020 AT&T Intellectual Property
6 # ================================================================================
7 # Licensed under the Apache License, Version 2.0 (the "License");
8 # you may not use this file except in compliance with the License.
9 # You may obtain a copy of the License at
11 # http://www.apache.org/licenses/LICENSE-2.0
13 # Unless required by applicable law or agreed to in writing, software
14 # distributed under the License is distributed on an "AS IS" BASIS,
15 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 # See the License for the specific language governing permissions and
17 # limitations under the License.
19 # SPDX-License-Identifier: Apache-2.0
20 # ============LICENSE_END=========================================================
25 ## Script to run onappf PDP-A, calls apexApps.sh
27 ## @package org.onap.policy.apex
28 ## @author Ajith Sreekumar <ajith.sreekumar@est.tech>
32 if [ -z "$APEX_USER" ]; then
36 id $APEX_USER > /dev/null 2>& 1
37 if [ "$?" != "0" ]; then
38 echo 'cannot run apex, user "'$APEX_USER'" does not exit'
42 if [ $(whoami) != "$APEX_USER" ]; then
43 echo 'Apex must be run as user "'$APEX_USER'"'
47 if [ -z $APEX_HOME ]; then
48 APEX_HOME="/opt/app/policy/apex-pdp"
51 if [ ! -d $APEX_HOME ]; then
53 echo 'Apex directory "'$APEX_HOME'" not set or not a directory'
54 echo "Please set environment for 'APEX_HOME'"
58 if [ -f "${HOME}/config/policy-truststore" ]; then
59 echo "overriding policy-truststore"
60 cp -f "${HOME}"/config/policy-truststore "${APEX_HOME}"/etc/ssl/
63 if [ -f "${HOME}"/config/policy-keystore ]; then
64 echo "overriding policy-keystore"
65 cp -f "${HOME}"/config/policy-keystore "${APEX_HOME}"/etc/ssl/
68 if [ -f "${HOME}"/config/logback.xml ]; then
69 echo "overriding logback.xml"
70 cp -f "${HOME}"/config/logback.xml "${APEX_HOME}"/etc/
73 if [ $(whoami) = "$APEX_USER" ]; then
74 $APEX_HOME/bin/apexApps.sh onappf $*
76 su $APEX_USER -c "$APEX_HOME/bin/apexApps.sh onappf $*"