diff options
Diffstat (limited to 'net-analyzer/nsca/files/nsca.init')
-rw-r--r-- | net-analyzer/nsca/files/nsca.init | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/net-analyzer/nsca/files/nsca.init b/net-analyzer/nsca/files/nsca.init new file mode 100644 index 000000000000..4f81b9d27ac5 --- /dev/null +++ b/net-analyzer/nsca/files/nsca.init @@ -0,0 +1,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 $? +} |