#!/sbin/sh
#
# inetd $Revision: 1.3.212.2 $ $Date: 96/04/15 13:42:35 $
#
#           Copyright (C) 1993, 1994 Hewlett-Packard Company
#
# NOTE:    This script is not configurable!  Any changes made to this
#          script will be overwritten when you upgrade to the next
#          release of HP-UX.
#

PATH=/sbin:/usr/sbin:/usr/bin
export PATH

rval=0
set_return() {
        x=$?
        if [ $x -ne 0 ]; then
                echo "EXIT CODE: $x"
                rval=1  # always 1 so that 2 can be used for other reasons
        fi
}

case "$1" in
start_msg)
	echo "Start Internet services  daemon"
	;;

stop_msg)
	echo "Stopping Internet services daemon"
	;;

'start')
	if [ -f /etc/rc.config ]; then
		. /etc/rc.config
	else
		echo "ERROR: /etc/rc.config defaults file MISSING"
	fi

	mask=`umask`
        umask 000

	[ -x /usr/sbin/inetd ] && /usr/sbin/inetd $INETD_ARGS
	if [ $? -eq 0 ]; then
		echo "Internet Services started"
	else
		echo "Unable to start Internet Services"
	fi

	umask $mask
	;;

'stop')
	if [ -f /etc/rc.config ]; then
		. /etc/rc.config
	else
		echo "ERROR: /etc/rc.config defaults file MISSING"
	fi

	/usr/sbin/inetd -k
	set_return
	if [ $rval -eq 0 ]; then
		echo "Internet Services stopped"
	else
		echo "Unable to stop Internet Services"
	fi
	;;

*)
	echo "usage: $0 {start|stop}"
	rval=1
	;;
esac

exit $rval

