#! /bin/sh
#
# xinetd        This starts and stops xinetd.
#
# chkconfig: 345 50 50
# description: xinetd is a powerful replacement for inetd. \
#	       xinetd has access control machanisms, extensive logging capabilities, \
#              the ability to make services available based on time, and can place \
#              limits on the number of servers that can be started, among other things.
#
# processname: xinetd
# pidfile: /var/run/xinetd.pid
# config: /etc/sysconfig/network
# config: /etc/xinetd.conf


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

# Get config.
. /etc/sysconfig/network

# Check that networking is up.
if [ ${NETWORKING} = "no" ]
then
	exit 0
fi

[ -f /usr/sbin/xinetd ] || exit 1
[ -f /etc/xinetd.conf ] || exit 1

# See how we were called.
case "$1" in
  start)
	echo -n "Starting xinetd: "
	daemon xinetd -pid 2> /var/run/xinetd.pid

	echo
	touch /var/lock/subsys/xinetd
	;;
  stop)

	echo -n "Stopping xinetd: "
	killproc xinetd

	echo
	rm -f /var/lock/subsys/xinetd
	;;
  status)
	status xinetd
	;;
  restart|reload)
	killproc -USR2 xinetd
	;;
  sreload)
        killproc -USR1 xinetd
  *)
	echo "Usage: xinetd {start|stop|status|restart|reload|sreload}"
	exit 1
esac

exit 0
