#!/bin/sh
#
# Copyright (C) 2002 - 2024 Joshua Birnbaum <engineer@noorg.org>.
# All Rights Reserved.
# 
# ifchkboot	This shell script starts and stops ifchk.
#
# Target:	Linux - CentOS 5/6, Red Hat Enterprise Linux 5/6.
#
# chkconfig: 35 99 01
#
# description:	ifchk is a promiscuous mode detection and \
#		network interface metrics reporting tool.

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

# Location of ifchk binary - user modifiable.
IFCHK=/usr/local/sbin/ifchk

# Location of ifchk config - user modifiable.
IFCHK_CONF=/usr/local/etc/ifchk.conf

RETVAL=0

case "$1" in
  start)
	# Start ifchk in daemon mode.
	echo -n $"Starting ifchk: "
	$IFCHK -f $IFCHK_CONF 2> /dev/null
	RETVAL=$?
	if [ $RETVAL -ne 0 ]; then
        	failure
    	else
        	success
    	fi
        ;;

  stop)
  	# Stop ifchk.
	echo -n $"Stopping ifchk: "
	killproc ifchk
        ;;

  status)
  	# Get ifchk status.
	status ifchk
        ;;

  *)
        echo $"Usage: $0 {start|stop|status}"
        exit 1
esac

exit 0
