#!/bin/bash
#
# Startup script for prolingadatd
#
# chkconfig: 2345 80 20
# description: Starts the ProLinga-Data Service.

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

test -x /usr/bin/prolingadatd || exit 0

RETVAL=0

#
#	See how we were called.
#

prog="prolingadatd"

start() {
	# Check if prolingadatd is already running
	if [ ! -f /var/lock/subsys/prolingadatd ]; then
	    gprintf "Starting %s: " "$prog"
	    daemon /usr/bin/prolingadatd
	    RETVAL=$?
	    [ $RETVAL -eq 0 ] && touch /var/lock/subsys/prolingadatd
	    echo
	fi
	return $RETVAL
}

stop() {
	gprintf "Stopping %s: " "$prog"
	killproc /usr/bin/prolingadatd
	RETVAL=$?
	[ $RETVAL -eq 0 ] && rm -f /var/lock/subsys/prolingadatd
	echo
        return $RETVAL
}


restart() {
	stop
	start
}	

reload() {
	restart
}	

status_at() {
 	status /usr/bin/prolingadatd
}

case "$1" in
start)
	start
	;;
stop)
	stop
	;;
reload|restart)
	restart
	;;
condrestart)
	if [ -f /var/lock/subsys/prolingadatd ]; then
	    restart
	fi
	;;
status)
	status prolingadatd
	;;
*)
	gprintf "Usage: %s {start|stop|restart|condrestart|status}\n" "$0"
	exit 1
esac

exit $?
exit $RETVAL
