wok annotate nagios/stuff/nagios @ rev 22802
freetype: add freetype-config
author | Pascal Bellard <pascal.bellard@slitaz.org> |
---|---|
date | Tue Jan 28 09:23:39 2020 +0100 (2020-01-28) |
parents | 0d8a1a3edc72 |
children |
rev | line source |
---|---|
erjo@8330 | 1 #!/bin/sh |
al@19159 | 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 |
al@19159 | 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 { |
al@19159 | 20 $DAEMON -v $CONFIG_FILE |
erjo@8330 | 21 } |
erjo@8330 | 22 |
pascal@16681 | 23 if [ ! -d /var/run/nagios ]; then |
al@19159 | 24 mkdir -p /var/run/nagios |
al@19159 | 25 chown nagios.nagios /var/run/nagios |
pascal@16681 | 26 fi |
erjo@8330 | 27 case "$1" in |
erjo@8330 | 28 start) |
erjo@8330 | 29 if active_pidfile $PIDFILE nagios ; then |
al@19159 | 30 _ '%s is already running.' $NAME |
erjo@8330 | 31 exit 1 |
erjo@8330 | 32 fi |
al@19159 | 33 action 'Starting %s: %s...' "$DESC" $NAME |
al@19159 | 34 $DAEMON $OPTIONS |
al@19159 | 35 #/usr/bin/nagios -d /etc/nagios/nagios.cfg |
erjo@8330 | 36 status |
erjo@8330 | 37 ;; |
erjo@8330 | 38 stop) |
erjo@8330 | 39 if ! active_pidfile $PIDFILE nagios ; then |
al@19159 | 40 _ '%s is not running.' $NAME |
erjo@8330 | 41 exit 1 |
erjo@8330 | 42 fi |
al@19159 | 43 status 'Stopping %s: %s...' "$DESC" $NAME |
al@19159 | 44 kill $(cat $PIDFILE) |
erjo@8330 | 45 status |
erjo@8330 | 46 ;; |
erjo@8330 | 47 restart|reload) |
erjo@8330 | 48 if ! active_pidfile $PIDFILE nagios ; then |
al@19159 | 49 _ '%s is not running.' $NAME |
erjo@8330 | 50 exit 1 |
erjo@8330 | 51 fi |
al@19159 | 52 action 'Restarting %s: %s...' "$DESC" $NAME |
al@19159 | 53 kill $(cat $PIDFILE) |
erjo@8330 | 54 sleep 2 |
erjo@8330 | 55 $DAEMON $OPTIONS |
erjo@8330 | 56 status |
erjo@8330 | 57 ;; |
erjo@8330 | 58 test) |
al@19159 | 59 configtest |
al@19159 | 60 ;; |
erjo@8330 | 61 *) |
al@19159 | 62 emsg "<n><b>$(_ 'Usage:')</b> $0 [start|stop|restart|reload|test]" |
al@19159 | 63 newline |
erjo@8330 | 64 exit 1 |
erjo@8330 | 65 ;; |
erjo@8330 | 66 esac |
erjo@8330 | 67 |
erjo@8330 | 68 exit 0 |