#!/bin/bash
#
# chkconfig: 2345 50 50
# description: IP protocols logger - logs TCP and ICMP.
#
# Source function library.
. /etc/rc.d/init.d/functions

# Source networking configuration.
. /etc/sysconfig/network

PLOGTCP="-q"
PLOGUDP="-q"
PLOGICMP="-q"

if [ -r /etc/protolog.conf ]; then
. /etc/protolog.conf
fi

# Check that networking is up.
[ ${NETWORKING} = "no" ] && exit 0
# See how we were called.
case "$1" in
  start)
        show Starting protolog TCP daemon:
        daemon plogtcp $PLOGTCP
	show Starting protolog UDP daemon:
	daemon plogudp $PLOGUDP
	show Starting protolog ICMP daemon:
	daemon plogicmp $PLOGICMP
        touch /var/lock/subsys/protolog
        ;;
  stop)
        show Stopping protolog TCP daemon:
        killproc plogtcp
	show Stopping protolog UDP daemon:
	killproc plogudp
	show Stopping protolog ICMP daemon:
	killproc plogicmp
        rm -f /var/lock/subsys/protolog
        ;;
  status)
        status protolog
        ;;
  restart)
        $0 stop
	$0 start
        ;;
  *)
        echo "Usage: $0 {start|stop|status|restart}"
        exit 1
esac

exit 0
