#!/bin/sh

### BEGIN INIT INFO
# Provides: ftscanhvd
# 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 ftscanhvd.
### END INIT INFO

set -e

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

# 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 $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