Blob Blame History Raw
#!/bin/sh
#
# vmtoolsd - Open VMware Tools Daemon
#
# chkconfig:   - 80 20
# description: Open VMware Tools daemon for virtual machines hosted on VMware.

### BEGIN INIT INFO
# Required-Start: $local_fs
# Required-Stop: $local_fs
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: Open VMware Tools daemon for virtual machines hosted on VMware.
# Description: Open VMware Tools daemon is part of open-vm-tools project,
#              an open source implementation of VMware Tools. It loads
#              various open-vm-tools plugins and makes their services
#              available to the guest OS for improved usability and to
#              the VM management applications for easier administration.
### END INIT INFO

# Source function library.
. /etc/rc.d/init.d/functions

exec="/usr/bin/vmtoolsd"
prog=${exec##*/}

[ -e /etc/sysconfig/$prog ] && . /etc/sysconfig/$prog

lockfile=/var/lock/subsys/$prog

start() {
    [ -x $exec ] || exit 5
    echo -n $"Starting $prog: "
    daemon $exec --background=/var/run/$prog.pid
    retval=$?
    echo
    [ $retval -eq 0 ] && touch $lockfile
    return $retval
}

stop() {
    echo -n $"Stopping $prog: "
    killproc $prog
    retval=$?
    echo
    [ $retval -eq 0 ] && rm -f $lockfile
    return $retval
}

restart() {
    stop
    start
}

rh_status() {
    # run checks to determine if the service is running or use generic status
    status $prog
}

rh_status_q() {
    rh_status >/dev/null 2>&1
}

case "$1" in
    start)
        rh_status_q && exit 0
        $1
        ;;
    stop)
        rh_status_q || exit 0
        $1
        ;;
    restart)
        $1
        ;;
    force-reload)
        restart
        ;;
    status)
        rh_status
        ;;
    try-restart|condrestart)
        rh_status_q || exit 0
        restart
	  ;;
    reload)
        action $"Service ${0##*/} does not support the reload action: " /bin/false
        exit 3
        ;;
    *)
        echo $"Usage: $0 {start|stop|status|restart|try-restart|force-reload}"
        exit 2
esac
exit $?