wok view nagios/stuff/nagios @ rev 25306
sip-4.19.25: last version for Python 2
author | Hans-G?nter Theisgen |
---|---|
date | Wed Jul 20 10:39:41 2022 +0100 (2022-07-20) |
parents | 0d8a1a3edc72 |
children |
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 _ '%s is already running.' $NAME
31 exit 1
32 fi
33 action 'Starting %s: %s...' "$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 _ '%s is not running.' $NAME
41 exit 1
42 fi
43 status 'Stopping %s: %s...' "$DESC" $NAME
44 kill $(cat $PIDFILE)
45 status
46 ;;
47 restart|reload)
48 if ! active_pidfile $PIDFILE nagios ; then
49 _ '%s is not running.' $NAME
50 exit 1
51 fi
52 action 'Restarting %s: %s...' "$DESC" $NAME
53 kill $(cat $PIDFILE)
54 sleep 2
55 $DAEMON $OPTIONS
56 status
57 ;;
58 test)
59 configtest
60 ;;
61 *)
62 emsg "<n><b>$(_ 'Usage:')</b> $0 [start|stop|restart|reload|test]"
63 newline
64 exit 1
65 ;;
66 esac
68 exit 0