| 1 |
#!/sbin/runscript
|
| 2 |
# Copyright 1999-2012 Gentoo Foundation
|
| 3 |
# Distributed under the terms of the GNU General Public License v2
|
| 4 |
# $Header: /var/cvsroot/gentoo-x86/net-analyzer/nagios-nsca/files/nsca.init,v 1.3 2012/08/23 21:23:31 flameeyes Exp $
|
| 5 |
|
| 6 |
: ${CFGFILE:=/etc/nagios/nsca.cfg}
|
| 7 |
|
| 8 |
get_config() {
|
| 9 |
[ -f ${CFGFILE} ] || return 1
|
| 10 |
|
| 11 |
sed -n -e 's:^[ \t]*'$1'=\([^#]\+\).*:\1:p' \
|
| 12 |
${CFGFILE}
|
| 13 |
}
|
| 14 |
|
| 15 |
extra_started_commands="reload"
|
| 16 |
|
| 17 |
command=/usr/libexec/${SVCNAME}
|
| 18 |
command_args="-c ${CFGFILE} --daemon"
|
| 19 |
pidfile=$(get_config pid_file)
|
| 20 |
|
| 21 |
depend() {
|
| 22 |
config ${CFGFILE}
|
| 23 |
|
| 24 |
need net
|
| 25 |
case $(get_config nsca_user) in
|
| 26 |
icinga) need icinga ;;
|
| 27 |
nagios) need nagios ;;
|
| 28 |
esac
|
| 29 |
}
|
| 30 |
|
| 31 |
reload() {
|
| 32 |
ebegin "Reloading nsca"
|
| 33 |
kill -HUP `cat $(get_config pid_file)`
|
| 34 |
eend $? "Failed to reload nsca"
|
| 35 |
}
|