3 #-------------------------------------------------------------------------------
4 # ============LICENSE_START=======================================================
5 # Copyright (C) 2016-2018 Ericsson. All rights reserved.
6 # Modifications Copyright (C) 2020-2021 AT&T Intellectual Property.
7 # ================================================================================
8 # Licensed under the Apache License, Version 2.0 (the "License");
9 # you may not use this file except in compliance with the License.
10 # You may obtain a copy of the License at
12 # http://www.apache.org/licenses/LICENSE-2.0
14 # Unless required by applicable law or agreed to in writing, software
15 # distributed under the License is distributed on an "AS IS" BASIS,
16 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17 # See the License for the specific language governing permissions and
18 # limitations under the License.
20 # SPDX-License-Identifier: Apache-2.0
21 # ============LICENSE_END=========================================================
22 #-------------------------------------------------------------------------------
25 ## Script to run the APEX, calls apexApps.sh
27 ## @package org.onap.policy.apex
28 ## @author Sven van der Meer <sven.van.der.meer@ericsson.com>
32 ## DO NOT CHANGE CODE BELOW, unless you know what you are doing
35 if [ -z "${APEX_USER}" ]; then
39 id $APEX_USER > /dev/null 2>& 1
40 if [ "$?" != "0" ]; then
41 echo 'cannot run apex, user "'$APEX_USER'" does not exit'
45 if [ $(whoami) != "$APEX_USER" ]; then
46 echo 'Apex must be run as user "'$APEX_USER'"'
50 if [ -z "${APEX_HOME}" ]; then
51 APEX_HOME="/opt/app/policy/apex-pdp"
54 if [ ! -d "${APEX_HOME}" ]; then
56 echo 'Apex directory "'$APEX_HOME'" not set or not a directory'
57 echo "Please set environment for 'APEX_HOME'"
61 if [ $(whoami) = "$APEX_USER" ]; then
62 $APEX_HOME/bin/apexApps.sh engine $*
64 su $APEX_USER -c "$APEX_HOME/bin/apexApps.sh engine $*"