PIDLOG="./tdpsd.pid"
if [ -f $PIDLOG ]
then
	PID=`cat $PIDLOG `
	kill $PID 2> /dev/null
	RUNNING="yes"
    while [ $RUNNING = "yes" ]
    do
		sleep 1
    	RUNNING="no"
		ps -p $PID > /dev/null
		if [ $? -eq 0 ]
		then
			RUNNING="yes"
		fi
		if [ $RUNNING = "yes" ]
		then
			# Sometimes the signal is ignored?
			sleep 1
			kill $PID 2> /dev/null
		fi
    done;
	echo "TeamDrive Personal Server stopped"
else
	echo "$PIDLOG not found."
	echo "TeamDrive Personal Server may not be running"
fi
