Blame | Last modification | View Log | RSS feed
#!/bin/sh## Copyright (C) 1998-2010 VMware, Inc. All Rights Reserved.## This script manages the services needed to run VMware software# Basic support for IRIX style chkconfig# chkconfig: 235 25 6# description: This service starts and stops vmamqpdSCRIPTNAME="$(basename $(readlink -f "$0"))"MODNAME="vmamqpd"ETCDIR=/etc/vmware. $ETCDIR/bootstraplibdir="$LIBDIR"/vmware. "$libdir"/scripts/util.shload_settings "$libdir" || exit 1# This comment is a hack to prevent RedHat distributions from outputing# "Starting <basename of this script>" when running this startup script.# We just need to write the word daemon followed by a spaceSYSTEM_DAEMON=vmamqpdPIDFILE=/var/run/vmamqpd.pid# Make sure the ESC byte is literal: Ash does not support echo -erc_done='[71G done'rc_failed='[71Gfailed'## Utilities#upperCase() {echo "`echo $1|tr '[:lower:]' '[:upper:]'`"}vmware_start_daemon() {"$libdir/bin/$1" -d $PIDFILEreturn $?}vmware_stop_daemon() {if [ ! -e "$PIDFILE" ]; thenreturn 0fipid=`cat $PIDFILE`if [ "$pid" = "" ]; thenreturn 0fi# Kill the processkill -15 $pid# Give it a few seconds to shut down properlyfor f in '1 2 3 4 5 6 7 8 9 10'; doif ! ps $pid >/dev/null; then# No need to wait if it's already downbreakfisleep 1done# Give it a few seconds to shut down after the killfor f in '1 2 3 4 5 6 7 8 9 10'; doif ! ps $pid >/dev/null; then# No need to wait if it's already downbreakfisleep 1doneif ps $pid >/dev/null; then# Failed to kill it...return 1else# Success!rm -v $PIDFILEreturn 0fi}vmware_daemon_status() {echo -n "$1 "if vmware_check_pidfile "/var/run/$1.pid"; thenecho 'is running'elseecho 'is not running'exitcode=$(($exitcode + 1))fi}main(){# See how we were called.case "$1" instart)exitcode='0'vmware_exec 'Starting VMware AMQP Service:' vmware_start_daemon $SYSTEM_DAEMONexitcode=$(($exitcode + $?))if [ "$exitcode" -gt 0 ]; thenexit 1fi;;stop)exitcode='0'vmware_exec 'Stopping VMware AMQP Service:' vmware_stop_daemonexitcode=$(($exitcode + $?))if [ "$exitcode" -gt 0 ]; thenexit 1fi;;status)exitcode='0'vmware_daemon_status $SYSTEM_DAEMONexitcode=$(($exitcode + $?))if [ "$exitcode" -ne 0 ]; thenexit 1fi;;restart | force-reload)"$0" stop && "$0" start;;source)# Used to source the script so that functions can be# selectively overridden.return 0;;*)echo "Usage: `basename "$0"` {start|stop|status|restart|force-reload}"exit 1esacexit 0}main "$@"