#!/bin/sh
#chgconfig:
#description: start/stop the UniOTPSRV
start()
{
	if [ `pidof UniOTPSRV` ];then

		echo "UniOTPSRV is running..."

	else

		echo -n "Start UniOTPSRV ...."
		/usr/local/UniOTP/1.0/UniOTPSRV 
		[ $? -eq 0 ] && echo "			[Ok]"

	fi
}

stop()
{
	if [ `pidof UniOTPSRV` ];then
		echo -n "Stop UniOTPSRV ..."
		pidval=`pidof UniOTPSRV`
		kill -9 $pidval 
		if [ $? -eq 0 ];then
			echo "	 		[Ok]"
		else
			echo "			[Failed]"
		fi
	else
		echo "UniOTPSRV is not running."
	fi
}


if [ `id -u` != 0 ];then
	echo "Please run the Application as Root"
	exit 1
fi

case "$1" in
start)
	start
	;;
stop)
	stop
	;;
restart)
	stop
	start
	;;
*)
	echo "usage: start | stop | restart"
	exit 0;
esac
