wok view nagios/stuff/nagios @ rev 18058
Add py3k3: Python 3.3.x - py3k is 3.2.x
author | Nathan Neulinger <nneul@neulinger.org> |
---|---|
date | Sat May 16 14:55:13 2015 +0000 (2015-05-16) |
parents | 20ec44b61ab6 |
children | 7f188676b59c |
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 if [ ! -d /var/run/nagios ]; then
24 mkdir -p /var/run/nagios
25 chown nagios.nagios /var/run/nagios
26 fi
27 case "$1" in
28 start)
29 if active_pidfile $PIDFILE nagios ; then
30 echo "$NAME already running."
31 exit 1
32 fi
33 echo -n "Starting $DESC: $NAME... "
34 $DAEMON $OPTIONS
35 #/usr/bin/nagios -d /etc/nagios/nagios.cfg
36 status
37 ;;
38 stop)
39 if ! active_pidfile $PIDFILE nagios ; then
40 echo "$NAME is not running."
41 exit 1
42 fi
43 echo -n "Stopping $DESC: $NAME... "
44 kill `cat $PIDFILE`
45 status
46 ;;
47 restart|reload)
48 if ! active_pidfile $PIDFILE nagios ; then
49 echo "$NAME is not running."
50 exit 1
51 fi
52 echo -n "Restarting $DESC: $NAME... "
53 kill `cat $PIDFILE`
54 sleep 2
55 $DAEMON $OPTIONS
56 status
57 ;;
58 test)
59 configtest ;;
60 *)
61 echo ""
62 echo -e "\033[1mUsage:\033[0m /etc/init.d/`basename $0` [start|stop|restart|reload]"
63 echo ""
64 exit 1
65 ;;
66 esac
68 exit 0