summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'net-analyzer/nrpe/files/nrpe.init')
-rw-r--r--net-analyzer/nrpe/files/nrpe.init50
1 files changed, 50 insertions, 0 deletions
diff --git a/net-analyzer/nrpe/files/nrpe.init b/net-analyzer/nrpe/files/nrpe.init
new file mode 100644
index 000000000000..b1f343070eb6
--- /dev/null
+++ b/net-analyzer/nrpe/files/nrpe.init
@@ -0,0 +1,50 @@
+#!/sbin/runscript
+# Copyright 1999-2014 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+: ${CFGFILE:=/etc/nagios/nrpe.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}
+}
+
+reload() {
+ ebegin "Reloading ${SVCNAME}"
+ kill -1 `cat ${pidfile}`
+ eend $?
+}
+
+start()
+{
+ mkdir -p $(dirname $pidfile)
+ local _background=
+ ebegin "Starting ${name:-$RC_SVCNAME}"
+ eval start-stop-daemon --start \
+ --exec $command \
+ ${procname:+--name} $procname \
+ ${pidfile:+--pidfile} $pidfile \
+ $_background $start_stop_daemon_args \
+ -- $command_args
+ if eend $? "Failed to start $RC_SVCNAME"; then
+ service_set_value "command" "${command}"
+ [ -n "${pidfile}" ] && service_set_value "pidfile" "${pidfile}"
+ [ -n "${procname}" ] && service_set_value "procname" "${procname}"
+ return 0
+ fi
+ return 1
+}
+