#!/bin/sh
#
# oidentd		This shell script takes care of starting and stopping oidentd.
#
# chkconfig:	2345 80 30
# description:	oidentd is a TCP/IP IDENT protocol server 
#		
# processname:	oidentd
# config:	
# pidfile:

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

# Source networking configuration.
. /etc/sysconfig/network

# Source oident configureation.
if [ -f /etc/sysconfig/oidentd ] ; then
	. /etc/sysconfig/oidentd
else
	OIDENT_USER=nobody
	OIDENT_GROUP=proc
fi

# Check that networking is up.
if is_no "${NETWORKING}"; then
	msg_Network_Down oidentd
	exit 1
fi

# See how we were called.
case "$1" in
  start)
	# Start daemons.
	if [ ! -f /var/lock/subsys/oidentd ]; then
		msg_starting oidentd
		daemon oidentd -g $OIDENT_GROUP -u $OIDENT_USER $OIDENT_OPTIONS
		RETVAL=$?
		[ $RETVAL -eq 0 ] && touch /var/lock/subsys/oidentd
	else
		msg_Already_Running oidentd
	fi
	;;
  stop)
	# Stop daemons.
	if [ -f /var/lock/subsys/oidentd ]; then
		msg_stopping oidentd
		killproc oidentd
		rm -f /var/lock/subsys/oidentd >/dev/null 2>&1
	else
		msg_Not_Running oidentd
		exit 1
	fi	
	;;
  restart)
	$0 stop
	$0 start
	;;
  status)
	status oidentd
	;;
#  reload)
#	msg_reloading oidentd
#	killproc oidentd -HUP
#	;;
  *)
	msg_usage "$0 {start|stop|restart|status}"
	exit 1
esac

exit $RETVAL

