#!/bin/bash

. /etc/rc.conf
. /etc/rc.d/functions

NAGIOS_INIT="/etc/nagios/daemon-init"
case "$1" in
  start)
    stat_busy "Starting Nagios"
	$NAGIOS_INIT start > /dev/null 2>&1
    if [ $? -gt 0 ]; then
      stat_fail
    else
      add_daemon nagios
      stat_done
    fi
    ;;
  stop)
    stat_busy "Stopping Nagios"
	$NAGIOS_INIT stop > /dev/null 2>&1
    if [ $? -gt 0 ]; then
      stat_fail
    else
      rm_daemon nagios
      stat_done
    fi
    ;;
  restart)
    $0 stop
    sleep 1
    $0 start
    ;;
  reload|force-reload|status)
    $NAGIOS_INIT $1
	;;
  *)
    echo "usage: $0 {start|stop|restart|reload|force-reload|status}"  
esac
exit 0

