wok view nagios/stuff/nagios @ rev 13974

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