commit nagios-nrpe for openSUSE:Factory
Hello community, here is the log from the commit of package nagios-nrpe for openSUSE:Factory checked in at Fri Apr 30 01:52:34 CEST 2010. -------- --- nagios-nrpe/nagios-nrpe.changes 2010-03-06 22:06:27.000000000 +0100 +++ /mounts/work_src_done/STABLE/nagios-nrpe/nagios-nrpe.changes 2010-04-29 17:35:40.000000000 +0200 @@ -1,0 +2,9 @@ +Thu Apr 29 15:28:38 UTC 2010 - lars@linux-schulserver.de + +- use /var/run/nrpe/nrpe.pid for pidfile; nagios can be run as + different user/group which might cause conflicts +- clean up the init skript and implement automatic movement/ + creation of the pid directory +- package /var/run/nrpe/nrpe.pid as ghost + +------------------------------------------------------------------- calling whatdependson for head-i586 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ nagios-nrpe.spec ++++++ --- /var/tmp/diff_new_pack.RuXNsN/_old 2010-04-30 01:52:05.000000000 +0200 +++ /var/tmp/diff_new_pack.RuXNsN/_new 2010-04-30 01:52:05.000000000 +0200 @@ -34,7 +34,7 @@ Name: nagios-nrpe Summary: Nagios Remote Plug-In Executor Version: 2.12 -Release: 5 +Release: 6 License: GPLv2+ Group: System/Monitoring Url: http://www.nagios.org/ @@ -180,7 +180,11 @@ %endif # fix pid_file in nrpe.cfg -%{__sed} -i -e "s,^\(pid_file=\).*,\1/var/run/nagios/nrpe.pid," %buildroot/%_sysconfdir/nagios/nrpe.cfg +%{__sed} -i -e "s,^\(pid_file=\).*,\1/var/run/nrpe/nrpe.pid," %buildroot/%_sysconfdir/nagios/nrpe.cfg + +# create directory and pidfile (package them as ghost) +%{__mkdir_p} %{buildroot}/var/run/nrpe +touch %{buildroot}/var/run/nrpe/nrpe.pid %pre # Create user and group on the system if necessary @@ -235,6 +239,8 @@ %endif %_sysconfdir/init.d/nrpe %_sbindir/*nrpe +%ghost %dir /var/run/nrpe +%ghost /var/run/nrpe/nrpe.pid %files doc %defattr(644,root,root,755) ++++++ nrpe.init ++++++ --- /var/tmp/diff_new_pack.RuXNsN/_old 2010-04-30 01:52:05.000000000 +0200 +++ /var/tmp/diff_new_pack.RuXNsN/_new 2010-04-30 01:52:05.000000000 +0200 @@ -1,6 +1,7 @@ -#! /bin/sh +#!/bin/bash # # Copyright (c) 2010 SUSE Linux Products GmbH +# Authors: Lars Vogdt (2010) # # /etc/init.d/nrpe # and its symbolic link @@ -19,63 +20,60 @@ # Nagios plugins. ### END INIT INFO -NRPE_BIN=/usr/sbin/nrpe +NRPE_BIN="/usr/sbin/nrpe" test -x $NRPE_BIN || { echo "$NRPE_BIN not installed"; - if [ "$1" = "stop" ]; then exit 0; + if [ "$1" = "stop" ]; then exit 0; else exit 5; fi; } # Check for existence of needed config file and read it -NRPE_CONFIG=/etc/nagios/nrpe.cfg +NRPE_CONFIG="/etc/nagios/nrpe.cfg" test -r $NRPE_CONFIG || { echo "$NRPE_CONFIG not existing"; - if [ "$1" = "stop" ]; then exit 0; + if [ "$1" = "stop" ]; then exit 0; else exit 6; fi; } -# Source LSB init functions -# providing start_daemon, killproc, pidofproc, -# log_success_msg, log_failure_msg and log_warning_msg. -# This is currently not used by UnitedLinux based distributions and -# not needed for init scripts for UnitedLinux only. If it is used, -# the functions from rc.status should not be sourced or used. -#. /lib/lsb/init-functions +DEFAULT_PIDFILE="/var/run/nrpe/nrpe.pid" + +function get_value() { + if [ -n "$2" ]; then + set -- `grep ^$1 $2 | sed 's@=@ @' | tr -d '[:cntrl:]'` + else + set -- `grep ^$1 $NRPE_CONFIG | sed 's@=@ @' | tr -d '[:cntrl:]'` + fi + shift # remove first ARG => search-string + echo $* +} # Shell functions sourced from /etc/rc.status: -# rc_check check and set local and overall rc status -# rc_status check and set local and overall rc status -# rc_status -v ditto but be verbose in local rc status -# rc_status -v -r ditto and clear the local rc status -# rc_status -s display "skipped" and exit with status 3 -# rc_status -u display "unused" and exit with status 3 -# rc_failed set local and overall rc status to failed -# rc_failed <num> set local and overall rc status to <num> -# rc_reset clear local rc status (overall remains) -# rc_exit exit appropriate to overall rc status -# rc_active checks whether a service is activated by symlinks -# rc_splash arg sets the boot splash screen to arg (if active) . /etc/rc.status # Reset status of this service rc_reset -# Return values acc. to LSB for all commands but status: -# 0 - success -# 1 - generic or unspecified error -# 2 - invalid or excess argument(s) -# 3 - unimplemented feature (e.g. "reload") -# 4 - user had insufficient privileges -# 5 - program is not installed -# 6 - program is not configured -# 7 - program is not running -# 8--199 - reserved (8--99 LSB, 100--149 distrib, 150--199 appl) -# -# Note that starting an already running service, stopping -# or restarting a not-running service as well as the restart -# with force-reload (in case signaling is not supported) are -# considered a success. - case "$1" in start) # Start daemons. echo -n "Starting Nagios NRPE " + pid_file="$(get_value pid_file)" + nrpe_group="$(get_value nrpe_group)" + nrpe_user="$(get_value nrpe_user)" + PIDDIR=$(dirname $pid_file) + case "$PIDDIR" in + /var/run) + if [ x"$nrpe_user" != x"root" ]; then + DATESTRING=`date +"%Y%m%d"` + mv -f "$NRPE_CONFIG" "$NRPE_CONFIG-$DATESTRING" + sed -e "s|^pid_file.*|pid_file=$DEFAULT_PIDFILE|g" "$NRPE_CONFIG-$DATESTRING" > "$NRPE_CONFIG" + /bin/logger -t rcnrpe "Configured $pid_file in $NRPE_CONFIG moved to $DEFAULT_PIDFILE. Backup is $NRPE_CONFIG-$DATESTRING" + test -f "$pid_file" && rm "$pid_file" + install -d -m755 -o$nrpe_user -g$nrpe_group $(dirname "$DEFAULT_PIDFILE") + else + test -d "$PIDDIR" || mkdir -p "$PIDDIR" + fi + ;; + *) + test -d $(dirname "$DEFAULT_PIDFILE") || install -d -m755 -o$nrpe_user -g$nrpe_group $(dirname "$DEFAULT_PIDFILE") + ;; + esac /sbin/startproc $NRPE_BIN -c $NRPE_CONFIG -d # Remember status and be verbose ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Remember to have fun... -- To unsubscribe, e-mail: opensuse-commit+unsubscribe@opensuse.org For additional commands, e-mail: opensuse-commit+help@opensuse.org
participants (1)
-
root@hilbert.suse.de