#!/bin/sh
# $Owl: Owl/packages/xinetd/xinetd.init,v 1.8 2005/11/16 13:32:46 solar Exp $
#
# chkconfig: 345 56 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: /usr/sbin/xinetd
# config: /etc/xinetd.conf
# pidfile: /var/run/xinetd.pid

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

OWL_STARTUP_ENABLE=1

# Get config.
test -f /etc/sysconfig/network && . /etc/sysconfig/network

case "$1" in
start|restart)
	test "$NETWORKING" = "yes" || exit 0
	test -x /usr/sbin/xinetd -a -f /etc/xinetd.conf || exit 1
esac

case "$1" in
start)
	if [ "0$OWL_STARTUP_VERSION" -ge 3 ]; then
		daemon --pidfile /var/run/xinetd.pid --expect-user root \
			-- xinetd -pidfile /var/run/xinetd.pid
	else
		daemon xinetd -pidfile /var/run/xinetd.pid
	fi
	;;
stop)
	if [ "0$OWL_STARTUP_VERSION" -ge 3 ]; then
		killproc --pidfile /var/run/xinetd.pid --expect-user root xinetd
	else
		killproc xinetd
	fi
	;;
status)
	status --pidfile /var/run/xinetd.pid --expect-user root xinetd
	;;
restart)
	$0 stop
	$0 start
	;;
reload)
	if [ "0$OWL_STARTUP_VERSION" -ge 3 ]; then
		killproc --pidfile /var/run/xinetd.pid --expect-user root \
			-HUP xinetd
	else
		killproc xinetd -HUP
	fi
	;;
*)
	echo "Usage: xinetd {start|stop|status|restart|reload}"
	exit 1
esac

exit $?
