]> git.pld-linux.org Git - packages/nagios.git/blame - nagios.init
- added 'reload' in nagios.init
[packages/nagios.git] / nagios.init
CommitLineData
96018fcf
TO
1#!/bin/sh
2#
3# nagios Host/service/network monitoring daemon
4#
20cccccd 5# chkconfig: 345 85 24
96018fcf
TO
6# description: Host/service/network monitoring daemon which uses snort as NIDS
7#
8
9# Source function library
10. /etc/rc.d/init.d/functions
11
12# Get network config
13. /etc/sysconfig/network
14
15# Get service config
16[ -f /etc/sysconfig/nagios ] && . /etc/sysconfig/nagios
17
18# Check that networking is up.
19if is_yes "${NETWORKING}"; then
9405ddf7 20 if [ ! -f /var/lock/subsys/network -a "$1" != stop -a "$1" != status ]; then
043169b2 21 msg_network_down nagios
22 exit 1
23 fi
96018fcf 24else
043169b2 25 exit 0
96018fcf
TO
26fi
27
64d31ef5 28RETVAL=0
96018fcf
TO
29# See how we were called.
30case "$1" in
31 start)
32 # Check if the service is already running?
043169b2 33 if [ ! -f /var/lock/subsys/nagios ]; then
96018fcf 34 msg_starting nagios
043169b2 35 # remove stale cmd pipe (or nagios won't start if it exists)
36 rm -f /var/lib/nagios/rw/nagios.cmd
5e5e55c4 37 daemon /usr/sbin/nagios -d /etc/nagios/nagios.cfg </dev/null
043169b2 38 RETVAL=$?
1d9bbb7b
TO
39 if [ $RETVAL -eq 0 ]; then
40 touch /var/lock/subsys/nagios
41 chgrp http /var/lib/nagios/rw/nagios.cmd
42 fi
96018fcf 43 else
043169b2 44 msg_already_running nagios
96018fcf
TO
45 fi
46 ;;
47 stop)
043169b2 48 # Stop daemons.
96018fcf 49 if [ -f /var/lock/subsys/nagios ]; then
043169b2 50 msg_stopping nagios
51 killproc nagios -TERM
52 rm -f /var/lock/subsys/nagios > /dev/null 2>&1
53 else
96018fcf 54 msg_not_running nagios
96018fcf
TO
55 fi
56 ;;
57 status)
58 status nagios
64d31ef5 59 exit $?
96018fcf 60 ;;
b5170100
ŁJM
61 reload|force-reload)
62 if [ -f /var/lock/subsys/nagios ]; then
63 msg_reloading nagios
64 killproc nagios -HUP
65 RETVAL=$?
66 else
67 msg_not_running nagios >&2
68 exit 7
69 fi
70 ;;
71 restart)
96018fcf
TO
72 $0 stop
73 $0 start
64d31ef5 74 exit $?
96018fcf
TO
75 ;;
76 *)
b5170100 77 msg_usage "$0 {start|stop|restart|reload|force-reload|status}"
64d31ef5 78 exit 3
96018fcf
TO
79esac
80
81exit $RETVAL
This page took 0.090199 seconds and 4 git commands to generate.