Go to most recent revision | Blame | Compare with Previous | Last modification | View Log | RSS feed
#!/usr/bin/env bash## Copyright 1998-2010 VMware, Inc. All rights reserved.## This script manages the VMware USB Arbitrator service## Basic support for IRIX style chkconfig# chkconfig: 235 50 8# description: This services starts and stops the USB Arbitrator.# Load bootstrapper info. /etc/vmware/bootstrap# This defines echo_success() and echo_failure() on RedHatif [ -r "$INITSCRIPTDIR"'/functions' ]; then. "$INITSCRIPTDIR"'/functions'fivmware_failed() {if [ "`type -t 'echo_failure' 2>/dev/null`" = 'function' ]; thenecho_failureelseecho -n "$rc_failed"fi}vmware_success() {if [ "`type -t 'echo_success' 2>/dev/null`" = 'function' ]; thenecho_successelseecho -n "$rc_done"fi}# Execute a macrovmware_exec() {local msg="$1" # INlocal func="$2" # INshift 2# On Caldera 2.2, SIGHUP is sent to all our children when this script exits# I wanted to use shopt -u huponexit instead but their bash version# 1.14.7(1) is too old## Ksh does not recognize the SIG prefix in front of a signal nameif [ "$VMWARE_DEBUG" = 'yes' ]; then(trap '' HUP; "$func" "$@")else(trap '' HUP; "$func" "$@") >/dev/null 2>&1fiif [ "$?" -gt 0 ]; thenvmware_failedechoreturn 1fivmware_successechoreturn 0}# Start the virtual machine USB Arbitrator servicevmwareStartUSBArbitrator() {# The executable checks for already running instances, so it# is safe to just run it."$BINDIR"/vmware-usbarbitrator}# Stop the virtual machine USB Arbitrator servicevmwareStopUSBArbitrator() {# The service knows how to stop itself."$BINDIR"/vmware-usbarbitrator --kill}vmwareService() {case "$1" instart)vmware_exec 'VMware USB Arbitrator' vmwareStartUSBArbitratorexitcode=$(($exitcode + $?))if [ "$exitcode" -gt 0 ]; thenexit 1fi;;stop)vmware_exec 'VMware USB Arbitrator' vmwareStopUSBArbitratorexitcode=$(($exitcode + $?))if [ "$exitcode" -gt 0 ]; thenexit 1fi;;restart)"$SCRIPTNAME" stop && "$SCRIPTNAME" start;;*)echo "Usage: $BASENAME {start|stop|restart}"exit 1esac}SCRIPTNAME="$0"BASENAME=`basename "$SCRIPTNAME"`# Check permissionsif [ "`id -ur`" != '0' ]; thenecho 'Error: you must be root.'echoexit 1fivmwareService "$1"exit 0