#!/bin/sh

### BEGIN INIT INFO
# Provides: ftsprhvd
# Required-Start: $local_fs $all
# Required-Stop: $local_fs
# Default-Start: 2 3 4 5
# Default-Stop: 0 6
# Short-Description: This services starts and stops the ftsprhvd.
### END INIT INFO

set -e

BIN_DIR="/usr/lib/vmware/view/bin"
DAEMON_NAME="ftsprhvd"

# Check permissions
if [ "`id -ur`" != '0' ]
then
	echo 'Error: you must be root.'
	echo
	exit 1
fi

case "$1" in
	start)
		if [ -x $BIN_DIR/$DAEMON_NAME ]
		then
			$BIN_DIR/$DAEMON_NAME
		fi
		;;
	stop)
		killall -KILL $DAEMON_NAME
		;;
	restart)
		killall -KILL $DAEMON_NAME
		if [ -x $BIN_DIR/$DAEMON_NAME ]
		then
			$BIN_DIR/$DAEMON_NAME
		fi
		;;
	*)
		echo "Usage: $0 {start|stop|restart}"
		exit 1
esac