#!/bin/sh
# chkconfig: - 44 3
# description: Starts and stops all services needed for uniset-testproject
# processname: uniset-testproject
# pidfile: /var/run/uniset-testproject.pid

# Do not load RH compatibility interface.
WITHOUT_RC_COMPAT=1

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


# project source function library.
prefix=/usr
exec_prefix=/usr
bindir=/usr/bin
. ${bindir}/ctl-functions-uniset-testproject.sh

PROG=uniset-testproject
LOCKFILE=/var/lock/subsys/uniset-testproject
RETVAL=0

start()
{
	# check network
#   if ! ping -c 1 localhost 2>/dev/null 1>/dev/null; then
#		service network restart
#   fi
	
	# start
	if ! [ -e "$LOCKFILE" ]; then
		$BINDIR/ctl-all-uniset-testproject.sh start 2>/dev/null
	else
		passed "${PROG} startup"
	fi
}

stop()
{
	if ! [ -e "$LOCKFILE" ]; then
		$BINDIR/ctl-all-uniset-testproject.sh stop 2>/dev/null
	else
		passed "${PROG} stopped"
	fi
}

restart()
{
	stop
	start
}

status()
{
	$BINDIR/ctl-monit-uniset-testproject.sh status
	RETVAL=$?
	return $RETVAL
}

# See how we were called.
case "$1" in
	start)
		start
		;;
	stop)
		stop
		;;
	restart)
		restart
		;;
	condstop)
		if [ -e "$LOCKFILE" ]; then
			stop
		fi
		;;
	condrestart)
		if [ -e "$LOCKFILE" ]; then
			restart
		fi
		;;
	condreload)
		if [ -e "$LOCKFILE" ]; then
			reload
		fi
		;;
	status)
		status
		RETVAL=$?
		;;
	*)
		msg_usage "${0##*/} {start|stop|restart|condstop|condrestart|condreload|status}"
		RETVAL=1
esac

exit $RETVAL
