wok annotate nagios/stuff/nagios @ rev 15739

libofx-dev: update deps
author Dominique Corbex <domcox@slitaz.org>
date Wed Jan 01 20:46:28 2014 +0100 (2014-01-01)
parents b4044080e3a4
children 0d8a1a3edc72
rev   line source
erjo@8330 1 #!/bin/sh
erjo@12098 2 # /etc/init.d/nagios : Start, stop and restart Nagios server on SliTaz, at
erjo@8330 3 # boot time or with the command line.
erjo@8330 4 #
erjo@12098 5 # To start Nagios at boot time, just put nagios in the $RUN_DAEMONS
erjo@8330 6 # variable of /etc/rcS.conf and configure options with /etc/daemons.conf
erjo@8330 7 #
erjo@8330 8 . /etc/init.d/rc.functions
erjo@8330 9 . /etc/daemons.conf
erjo@8330 10
erjo@8330 11 NAME=Nagios
erjo@8330 12 DESC="Network Monitoring Server"
erjo@8330 13 DAEMON=/usr/bin/nagios
erjo@8330 14 CONFIG_FILE="/etc/nagios/nagios.cfg"
erjo@8330 15 OPTIONS="-d $CONFIG_FILE"
erjo@8330 16 PIDFILE=/var/run/nagios/nagios.pid
erjo@8330 17
erjo@8330 18 configtest()
erjo@8330 19 {
erjo@8330 20 $DAEMON -v $CONFIG_FILE
erjo@8330 21 }
erjo@8330 22
erjo@8330 23 case "$1" in
erjo@8330 24 start)
erjo@8330 25 if active_pidfile $PIDFILE nagios ; then
erjo@8330 26 echo "$NAME already running."
erjo@8330 27 exit 1
erjo@8330 28 fi
erjo@8330 29 echo -n "Starting $DESC: $NAME... "
erjo@8330 30 $DAEMON $OPTIONS
erjo@8330 31 #/usr/bin/nagios -d /etc/nagios/nagios.cfg
erjo@8330 32 status
erjo@8330 33 ;;
erjo@8330 34 stop)
erjo@8330 35 if ! active_pidfile $PIDFILE nagios ; then
erjo@8330 36 echo "$NAME is not running."
erjo@8330 37 exit 1
erjo@8330 38 fi
erjo@8330 39 echo -n "Stopping $DESC: $NAME... "
erjo@8330 40 kill `cat $PIDFILE`
erjo@8330 41 status
erjo@8330 42 ;;
erjo@8330 43 restart|reload)
erjo@8330 44 if ! active_pidfile $PIDFILE nagios ; then
erjo@8330 45 echo "$NAME is not running."
erjo@8330 46 exit 1
erjo@8330 47 fi
erjo@8330 48 echo -n "Restarting $DESC: $NAME... "
erjo@8330 49 kill `cat $PIDFILE`
erjo@8330 50 sleep 2
erjo@8330 51 $DAEMON $OPTIONS
erjo@8330 52 status
erjo@8330 53 ;;
erjo@8330 54 test)
erjo@8330 55 configtest ;;
erjo@8330 56 *)
erjo@8330 57 echo ""
erjo@8330 58 echo -e "\033[1mUsage:\033[0m /etc/init.d/`basename $0` [start|stop|restart|reload]"
erjo@8330 59 echo ""
erjo@8330 60 exit 1
erjo@8330 61 ;;
erjo@8330 62 esac
erjo@8330 63
erjo@8330 64 exit 0