Przeglądaj źródła

Additional (missed) changes for Upstart and slackware

John C. Frickson 9 lat temu
rodzic
commit
f32dc4313e

+ 1 - 1
build-aux/ax_nagios_get_distrib

@@ -126,7 +126,7 @@ AC_DEFUN([AX_NAGIOS_GET_DISTRIB_TYPE],
 				elif test -r "/etc/debian_version"; then
 					dist_type="debian"
 					if test -r "/etc/lsb-release"; then
-						. /etc/lsb_release
+						. /etc/lsb-release
 						dist_ver=`echo "$DISTRIB_RELEASE"`
 					else
 						dist_ver=`cat /etc/debian_version`

+ 18 - 15
build-aux/ax_nagios_get_files

@@ -54,31 +54,36 @@ AS_CASE([$init_type],
 
 	[sysv],
 		if test $dist_type = debian; then
-			src_init=debian-init.in
+			src_init=debian-init
 		else
-			src_init=default-init.in
+			src_init=default-init
 		fi,
 
 	[systemd],
-		src_init=default-service.in
-		src_inetd=default-service.in,
+		src_init=default-service
+		src_inetd=default-service,
 
-#	[*bsd],
+	[bsd],
+		src_init=bsd-init,
+
+	[newbsd],
+		src_init=newbsd-init,
 
 #	[gentoo],
 
 	[openrc],
-		src_init=openrc-init.in,
+		src_init=openrc-init,
 
 	[smf*],
-		src_init="solaris-@PKG_NAME@.xml.in"
-		src_inetd="solaris-@PKG_NAME@.xml.in",
+		src_init="solaris-@PKG_NAME@.xml"
+		src_inetd="solaris-@PKG_NAME@.xml",
 
-#	[upstart],
+	[upstart],
+		src_init=upstart-init,
 
 	[launchd],
-		src_init="mac-org.nagios.@PKG_NAME@.plist.in"
-		src_inetd="mac-org.nagios.@PKG_NAME@.plist.in",
+		src_init="mac-org.nagios.@PKG_NAME@.plist"
+		src_inetd="mac-org.nagios.@PKG_NAME@.plist",
 
 	[*],
 		src_init="unknown"
@@ -91,12 +96,10 @@ if test x$src_inetd = x; then
 
 	AS_CASE([$inetd_type],
 		[inetd],
-			src_inetd=default-inetd.in,
+			src_inetd=default-inetd,
 
 		[xinetd],
-			src_inetd=default-xinetd.in,
-
-#		[upstart],
+			src_inetd=default-xinetd,
 
 		[*],
 			src_inetd="unknown"

+ 1 - 1
build-aux/ax_nagios_get_paths

@@ -555,7 +555,7 @@ AS_CASE([$init_type],
 
 	[upstart],
 		initdir=${initdir="/etc/init"}
-		initname=${initname="$PKG_NAME"}
+		initname=${initname="$PKG_NAME.conf"}
 		initconfdir=${initconfdir="/etc/default"}
 		initconf=${initconf="$initconfdir/$PKG_NAME"},
 

+ 54 - 0
startup/newbsd-init.in

@@ -0,0 +1,54 @@
+#!/bin/sh
+#
+# Copyright (c) 2016 Nagios(R) Core(TM) Development Team
+#
+# PROVIDE: nrpe
+# REQUIRE: LOGIN
+# KEYWORD: shutdown
+
+#
+# Add the following lines to /etc/rc.conf to enable nrpe:
+#
+# nrpe_enable (bool):    Set to "NO" by default.
+#                        Set it to "YES" to enable nrpe.
+# nrpe_flags (str):      Set to "" by default.
+# nrpe_configfile (str): Set to "@pkgsysconfdir@/nrpe.cfg" by default.
+#
+
+. /etc/rc.subr
+
+sig_reload=HUP
+
+nrpe_enable=${nrpe_enable:-"NO"}
+command=${nrpe_program:-"@sbindir@/nrpe"}
+command_args="-c ${nrpe_configfile} -d"
+extra_commands=reload
+pidfile=${pidfile:-"/var/run/nrpe.pid"}
+nrpe_configfile=${nrpe_configfile:-"@pkgsysconfdir@/nrpe.cfg"}
+
+name=nrpe
+rcvar=nrpe_enable
+load_rc_config "${name}"
+required_files="${nrpe_configfile}"
+
+start_precmd=nrpe_prestart
+stop_precmd=find_pidfile
+
+find_pidfile()
+{
+    [ -n "$nrpe_pidfile" ] &&
+        warn "No longer necessary to set nrpe_pidfile in rc.conf[.local]"
+
+    if getpidfile_from_conf pid_file ${nrpe_configfile}; then
+        pidfile="$_pidfile_from_conf"
+	else
+	    pidfile='%%PIDDIR%%/nrpe.pid'
+}
+
+nrpe_prestart()
+{
+    find_pidfile
+    install -d -o ${nrpe_user:-nagios} ${pidfile%/*}
+}
+
+run_rc_command "$1"

+ 20 - 0
startup/upstart-init.in

@@ -0,0 +1,20 @@
+# nrpe - the Nagios Remote Plugin Executor
+#
+# nrpe is a program that runs plugins on this host
+# and reports the results back to a nagios server
+#
+# Copyright (c) 2016 Nagios(R) Core(TM) Development Team
+
+description		"the Nagios Remote Plugin Executor"
+
+oom score -800
+setgid @nrpe_group@
+setuid @nrpe_user@
+
+start on (local-filesystems and net-device-up IFACE!=lo)
+stop on runlevel [!2345]
+
+expect daemon
+respawn
+
+exec @sbindir@/nrpe -c @pkgsysconfdir@/nrpe.cfg -d