blob: 5e540189f2c8487da1098d20b2b048e6d7258eca (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
|
#!/sbin/runscript
# Copyright 1999-2004 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: /var/cvsroot/gentoo-x86/net-analyzer/nagios-core/files/nagios,v 1.10 2007/05/08 21:36:14 dertobi123 Exp $
opts="${opts} reload checkconfig"
depend() {
need net
use dns logger firewall
after mysql postgresql
}
reload()
{
checkconfig || return 1
ebegin "Reloading configuration"
killall -HUP nagios &>/dev/null
eend $?
}
checkconfig() {
# Silent Check
/usr/sbin/nagios -v /etc/nagios/nagios.cfg &>/dev/null && return 0
# Now we know there's problem - run again and display errors
/usr/sbin/nagios -v /etc/nagios/nagios.cfg
eend $? "Configuration Error. Please fix your configfile"
}
start() {
checkconfig || return 1
ebegin "Starting nagios"
touch /var/nagios/nagios.log /var/nagios/status.sav
chown nagios:nagios /var/nagios/nagios.log /var/nagios/status.sav
rm -f /var/nagios/rw/nagios.cmd
start-stop-daemon --quiet --start --startas /usr/sbin/nagios \
-e HOME="/var/nagios/home" --pidfile /var/nagios/nagios.lock \
-- -d /etc/nagios/nagios.cfg
eend $?
}
stop() {
ebegin "Stopping nagios"
start-stop-daemon --quiet --stop --pidfile /var/nagios/nagios.lock
rm -f /var/nagios/status.log /var/nagios/nagios.tmp /var/nagios/nagios.lock /var/nagios/rw/nagios.cmd
eend $?
}
svc_restart() {
checkconfig || return 1
ebegin "Restarting nagios"
svc_stop
svc_start
eend $?
}
|