aboutsummaryrefslogtreecommitdiffstats
path: root/dmaap-bc/misc
diff options
context:
space:
mode:
authorvarun gudisena <varuneshwar.gudisena@att.com>2019-04-12 19:15:43 +0000
committerGerrit Code Review <gerrit@onap.org>2019-04-12 19:15:43 +0000
commitce06845e9df9cdfa92db2b75c7f44bf3b96a4812 (patch)
treeddba15c71a9042aba74f6a41078e067fd8a2a169 /dmaap-bc/misc
parentc60f419fa447586f1b758ecca7458ae4d6d424e4 (diff)
parent85e7c7e57c262e38a0b3e0a14e4ebf4b92f00a58 (diff)
Merge "Run as non-root"
Diffstat (limited to 'dmaap-bc/misc')
-rw-r--r--dmaap-bc/misc/dmaapbc46
1 files changed, 20 insertions, 26 deletions
diff --git a/dmaap-bc/misc/dmaapbc b/dmaap-bc/misc/dmaapbc
index 74e8707..97ad226 100644
--- a/dmaap-bc/misc/dmaapbc
+++ b/dmaap-bc/misc/dmaapbc
@@ -25,7 +25,8 @@ umask 0022
TZ=GMT0
COMPONENT=dmaapbc
APP_ROOT=/opt/app/$COMPONENT
-USER=root
+USER=dbc
+GROUP=onap
export TZ
PATH=/usr/local/bin:/bin:/usr/bin:/usr/local/sbin:/usr/sbin:/sbin:/opt/java/jdk/jdk180/bin
export PATH
@@ -36,7 +37,22 @@ CONFIGMAP_PROPS=${CONFIGMAP_PROPS:-$CONFIGMAP_ROOT/conf/dmaapbc.properties}
CONTAINER_CONFIG=$CONFIGMAP_ROOT/conf/buscontroller.env
MAIN=org.onap.dmaap.dbcapi.server.Main
-
+authcheck() {
+ set -x
+ ID=`id -n -u`
+ GRP=`id -n -g`
+ if [ "$ID" != "$USER" ]
+ then
+ echo $COMPONENT must be started as user $USER not $ID
+ exit 1
+ fi
+ if [ "$GRP" != "$GROUP" ]
+ then
+ echo $COMPONENT must be started as group $GROUP not $GRP
+ exit 1
+ fi
+ set +x
+}
pids() {
set -x
@@ -92,18 +108,7 @@ config() {
start() {
echo "ENTER start"
set -x
- ID=`id -n -u`
- GRP=`id -n -g`
- if [ "$ID" != "$USER" ]
- then
- echo $COMPONENT must be started as user $USER not $ID
- exit 1
- fi
- if [ "$GRP" != "$USER" ]
- then
- echo $COMPONENT must be started as group $USER not $GRP
- exit 1
- fi
+ authcheck
cd $APP_ROOT
pwd
@@ -134,18 +139,7 @@ start() {
stop() {
echo "ENTER stop"
- ID=`id -n -u`
- GRP=`id -n -g`
- if [ "$ID" != "$USER" ]
- then
- echo $COMPONENT must be stopped as user $USER not $ID
- exit 1
- fi
- if [ "$GRP" != "$USER" ]
- then
- echo $COMPONENT must be stopped as group $USER not $GRP
- exit 1
- fi
+ authcheck
touch $APP_ROOT/etc/SHUTDOWN
PIDS=`pids`
if [ "$PIDS" != "" ]