#!/bin/bash
#
# inetd        This starts and stops inetd.
#
# chkconfig: 345 56 44
# description: inetd 
#
# processname: /usr/sbin/xinetd
# config: /etc/hosts.deny
# config: /etc/hosts.allow
# config: /etc/inetd.conf

IDF=/var/run/inetd.pid

if [ -s "$IDF" ]; then
   ID=`cat $IDF`
fi

case $1 in
  start|restart)  echo   "$1ing Internet superserver, inetd."
                  if [ -s "$IDF" ]; then
		     kill -9  $ID  &&  sleep 2
		     rm -f $IDF
		  fi
                  inetd
		  exit 0
                  ;;
           stop)  echo   "$1ping inetd."
                  if [ -s "$IDF" ]; then
		     kill -9  $ID
		     rm -f $IDF
		  fi
		  exit 0
                  ;;
              *)  echo   "Usage: $0 {start|stop|restart}"
                  ;;
esac
