#!/bin/sh
# This is the networking startup and stop file.

. /etc/system_config

killproc() {
   pid=`/bin/ps -x | /usr/bin/grep $1 | /usr/bin/awk '{ print $1 }'`
   kill -TERM $pid 2> /dev/null > /dev/null
}

# Constants.
NET="/usr/sbin"

case "$1" in
'start')
   echo -n "$0: Start NET "
   if [ $DONET = "yes" ]
   then

     # set domainname
     /sbin/domainname $DOMAIN

     # Start the SUN RPC Portmapper.
     if [ -x ${NET}/portmap ]; then
	echo -n "portmap "
	${NET}/portmap
     fi

     # Start the INET SuperServer
     if [ -x ${NET}/inetd ]; then
	echo -n "inetd "
	${NET}/inetd
     else
	echo "no INETD found.  INET cancelled!"
	exit 1
     fi

     # Start the NAMED/BIND name server.
     #if [ -x ${NET}/named ]; then
     #   echo -n "named "
     #   ${NET}/named
     #fi

     # Start the ROUTEd server.
     #if [ -x ${NET}/routed ]; then
     #   echo -n "routed "
     #   ${NET}/routed -g -s
     #fi

     # Start the RWHO server.
     if [ -x ${NET}/rwhod ]; then
	echo -n "rwhod "
	${NET}/rwhod -t -s
     fi
   fi # if [ $DONET = "yes" ]
   echo
   ;;
'stop')
   echo "$0: Stop NET"
   if [ $DONET = "yes" ]
   then
      killproc rwhod
      killproc routed
      killproc named
      killproc inetd
      killproc portmap
   fi
   ;;
*)
   echo "Usage: $0 { start | stop }"
   ;;
esac
