summaryrefslogtreecommitdiff
blob: 4f81b9d27ac586bfcdfbd7b16927a03eec575aa9 (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
#!/sbin/runscript
# Copyright 1999-2012 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Id$

: ${CFGFILE:=/etc/nagios/nsca.cfg}

get_config() {
    [ -f ${CFGFILE} ] || return 1

    sed -n -e 's:^[ \t]*'$1'=\([^#]\+\).*:\1:p' \
	${CFGFILE}
}

extra_started_commands="reload"

command=/usr/libexec/${SVCNAME}
command_args="-c ${CFGFILE} --daemon"
pidfile=$(get_config pid_file)

depend() {
    config ${CFGFILE}

    case $(get_config nsca_user) in
	icinga) need icinga ;;
	nagios) need nagios ;;
    esac
}

reload() {
    ebegin "Reloading ${SVCNAME}"
    kill -HUP `cat $(get_config pid_file)`
    eend $?
}