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