123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146 |
- #!/usr/bin/env bash
- # chkconfig: 345 95 20
- # description: ambari-server daemon
- # processname: ambari-server
- # 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.
- # /etc/init.d/ambari-server
- VERSION="${ambariVersion}"
- HASH="${buildNumber}"
- case "$1" in
- --version)
- echo -e $VERSION
- exit 0
- ;;
- --hash)
- echo -e $HASH
- exit 0
- ;;
- esac
- export PATH=/usr/lib/ambari-server/*:$PATH:/sbin/:/usr/sbin
- export AMBARI_CONF_DIR=/etc/ambari-server/conf:$PATH
- # Because Ambari rpm unpacks modules here on all systems
- export PYTHONPATH=/usr/lib/python2.6/site-packages:$PYTHONPATH
- if [ -a /usr/bin/python2.7 ] && [ -z "$PYTHON" ]; then
- PYTHON=/usr/bin/python2.7
- fi
- if [ -a /usr/bin/python2.6 ] && [ -z "$PYTHON" ]; then
- PYTHON=/usr/bin/python2.6
- fi
- if [ -a /var/lib/ambari-server/ambari-env.sh ]; then
- . /var/lib/ambari-server/ambari-env.sh
- fi
- if [ -z "$PYTHON" ]; then
- PYTHON=/usr/bin/python
- fi
- if [ -z "$AMBARI_PASSPHRASE" ]; then
- AMBARI_PASSPHRASE="DEV"
- fi
- if [ -n "$JAVA_HOME" ]; then
- export JAVA_HOME=$JAVA_HOME
- fi
- export AMBARI_PASSPHRASE=$AMBARI_PASSPHRASE
- # check for version
- majversion=`$PYTHON -V 2>&1 | awk '{print $2}' | cut -d'.' -f1`
- minversion=`$PYTHON -V 2>&1 | awk '{print $2}' | cut -d'.' -f2`
- numversion=$(( 10 * $majversion + $minversion))
- if (( $numversion < 26 )); then
- echo "Need python version > 2.6"
- exit 1
- fi
- echo "Using python " $PYTHON
- case "$1" in
- start)
- echo -e "Starting ambari-server"
- $PYTHON /usr/sbin/ambari-server.py $@
- ;;
- stop)
- echo -e "Stopping ambari-server"
- $PYTHON /usr/sbin/ambari-server.py $@
- ;;
- reset)
- echo -e "Resetting ambari-server"
- $PYTHON /usr/sbin/ambari-server.py $@
- ;;
- restart)
- echo -e "Restarting ambari-server"
- $0 stop
- $0 start
- ;;
- upgrade)
- echo -e "Upgrading ambari-server"
- $PYTHON /usr/sbin/ambari-server.py $@
- ;;
- status)
- echo -e "Ambari-server status"
- $PYTHON /usr/sbin/ambari-server.py $@
- ;;
- upgradestack)
- echo -e "Upgrading stack of ambari-server"
- $PYTHON /usr/sbin/ambari-server.py $@
- ;;
- setup)
- echo -e "Setup ambari-server"
- $PYTHON /usr/sbin/ambari-server.py $@
- ;;
- setup-ldap)
- echo -e "Setting up LDAP properties..."
- $PYTHON /usr/sbin/ambari-server.py $@
- ;;
- sync-ldap)
- echo -e "Syncing with LDAP..."
- $PYTHON /usr/sbin/ambari-server.py $@
- ;;
- setup-security)
- echo -e "Security setup options..."
- $PYTHON /usr/sbin/ambari-server.py $@
- ;;
- refresh-stack-hash)
- echo -e "Refreshing stack hashes..."
- $PYTHON /usr/sbin/ambari-server.py $@
- ;;
- backup)
- echo -e "Backing up Ambari File System state... *this will not backup the server database*"
- $PYTHON /usr/sbin/ambari-server.py $@
- ;;
- restore)
- echo -e "Restoring Ambari File System state"
- $PYTHON /usr/sbin/ambari-server.py $@
- ;;
- *)
- echo "Usage: /usr/sbin/ambari-server
- {start|stop|restart|setup|upgrade|status|upgradestack|setup-ldap|sync-ldap|setup-security|refresh-stack-hash|backup|restore} [options]
- Use usr/sbin/ambari-server <action> --help to get details on options available.
- Or, simply invoke ambari-server.py --help to print the options."
- exit 1
- esac
- exit 0
|