blob: 9dd781c6357391ba28e800de97d6ad25f7b2a579 [file] [log] [blame]
#!/bin/bash
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
if [ ! -e ${RANGER_HOME}/.setupDone ]
then
SETUP_RANGER=true
else
SETUP_RANGER=false
fi
if [ "${SETUP_RANGER}" == "true" ]
then
if [ "${KERBEROS_ENABLED}" == "true" ]
then
${RANGER_SCRIPTS}/wait_for_keytab.sh rangeradmin.keytab
${RANGER_SCRIPTS}/wait_for_keytab.sh rangerlookup.keytab
${RANGER_SCRIPTS}/wait_for_keytab.sh HTTP.keytab
fi
cd "${RANGER_HOME}"/admin || exit
if ./setup.sh;
then
if [ "${KERBEROS_ENABLED}" == "true" ]
then
cp ${RANGER_SCRIPTS}/core-site.xml ${RANGER_HOME}/admin/conf/core-site.xml
fi
touch "${RANGER_HOME}"/.setupDone
else
echo "Ranger Admin Setup Script didn't complete proper execution."
fi
fi
cd ${RANGER_HOME}/admin && ./ews/ranger-admin-services.sh start
if [ "${SETUP_RANGER}" == "true" ]
then
# Wait for Ranger Admin to become ready
sleep 30
python3 ${RANGER_SCRIPTS}/create-ranger-services.py
fi
RANGER_ADMIN_PID=`ps -ef | grep -v grep | grep -i "org.apache.ranger.server.tomcat.EmbeddedServer" | awk '{print $2}'`
# prevent the container from exiting
if [ -z "$RANGER_ADMIN_PID" ]
then
echo "Ranger Admin process probably exited, no process id found!"
else
tail --pid=$RANGER_ADMIN_PID -f /dev/null
fi