wok-4.x view nagios/stuff/nagios @ rev 10392
gparted: can't cross (use native)
author | Christophe Lincoln <pankso@slitaz.org> |
---|---|
date | Mon May 23 18:59:09 2011 +0200 (2011-05-23) |
parents | |
children | 20ec44b61ab6 |
line source
1 #!/bin/sh
2 # /etc/init.d/nagios : Start, stop and restart SSH server on SliTaz, at
3 # boot time or with the command line.
4 #
5 # To start SSH server 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