packages: nagios-ndoutils/nagios-ndoutils.spec, nagios-ndoutils/ndo2db.init...

glen glen at pld-linux.org
Sat Jan 14 23:49:50 CET 2012


Author: glen                         Date: Sat Jan 14 22:49:50 2012 GMT
Module: packages                      Tag: HEAD
---- Log message:
- add pldized initscript

---- Files affected:
packages/nagios-ndoutils:
   nagios-ndoutils.spec (1.4 -> 1.5) , ndo2db.init (NONE -> 1.1)  (NEW)

---- Diffs:

================================================================
Index: packages/nagios-ndoutils/nagios-ndoutils.spec
diff -u packages/nagios-ndoutils/nagios-ndoutils.spec:1.4 packages/nagios-ndoutils/nagios-ndoutils.spec:1.5
--- packages/nagios-ndoutils/nagios-ndoutils.spec:1.4	Sat Jan 14 23:38:32 2012
+++ packages/nagios-ndoutils/nagios-ndoutils.spec	Sat Jan 14 23:49:44 2012
@@ -1,6 +1,5 @@
 # $Revision$, $Date$
 # TODO
-# - NDO2DB initscript (subpkg?)
 # - add db/{installdb,upgradedb} (Perl) somewhere
 #
 # Conditional build:
@@ -9,7 +8,7 @@
 %bcond_without	ssl	# build without ssl support
 
 %define		extraver	b9
-%define		rel		0.2
+%define		rel		0.3
 Summary:	NDOUTILS (Nagios Data Output Utils) addon
 Summary(pl.UTF-8):	Dodatek NDOUTILS (Nagios Data Output Utils)
 Name:		nagios-ndoutils
@@ -19,6 +18,7 @@
 Group:		Networking
 Source0:	http://downloads.sourceforge.net/nagios/ndoutils-%{version}%{extraver}.tar.gz
 # Source0-md5:	659b759a5eb54b84eb44a29f26b603bc
+Source1:	ndo2db.init
 URL:		http://sourceforge.net/projects/nagios/
 %{?with_mysql:BuildRequires:	mysql-devel}
 %{?with_ssl:BuildRequires:	openssl-devel}
@@ -52,7 +52,7 @@
 	%{?with_ssl:--enable-ssl} \
 	--bindir=%{_sbindir} \
 	--with-init-dir=/etc/rc.d/init.d
-%{__make}
+%{__make} -j1
 
 %install
 rm -rf $RPM_BUILD_ROOT
@@ -63,6 +63,8 @@
 	INIT_OPTS="" \
 	DESTDIR=$RPM_BUILD_ROOT
 
+install -p %{SOURCE1} $RPM_BUILD_ROOT/etc/rc.d/init.d/ndo2db
+
 mv $RPM_BUILD_ROOT{%{_sbindir},%{_libdir}}/ndomod.o
 
 for sample in $RPM_BUILD_ROOT%{_sysconfdir}/*-sample; do
@@ -70,12 +72,10 @@
 	mv $sample $cfg
 done
 
+# sample line that should be added to nagios.cfg for this module to work
 echo 'broker_module=%{_libdir}/ndomod.o config_file=%{_sysconfdir}/ndomod.cfg' \
 	> $RPM_BUILD_ROOT%{_sysconfdir}/ndomod-load.cfg
 
-# daemon startup:
-# ndo2db -c %{_sysconfdir}/ndo2db.cfg
-
 %clean
 rm -rf $RPM_BUILD_ROOT
 
@@ -99,6 +99,9 @@
 All persons listed below can be reached at <cvs_login>@pld-linux.org
 
 $Log$
+Revision 1.5  2012/01/14 22:49:44  glen
+- add pldized initscript
+
 Revision 1.4  2012/01/14 22:38:32  glen
 - up to 1.4b9; enable ssl; bconds for mysql, pgsql, ssl
 

================================================================
Index: packages/nagios-ndoutils/ndo2db.init
diff -u /dev/null packages/nagios-ndoutils/ndo2db.init:1.1
--- /dev/null	Sat Jan 14 23:49:50 2012
+++ packages/nagios-ndoutils/ndo2db.init	Sat Jan 14 23:49:44 2012
@@ -0,0 +1,114 @@
+#!/bin/sh
+#
+# Nagios NDO2DB Initscript
+#
+# chkconfig:	345 99 01
+#
+# description:	Nagios Data Out Daemon
+#
+# processname:	ndo2db
+# config:
+# pidfile:
+
+### BEGIN INIT INFO
+# Provides:          ndo2db
+# Required-Start:
+# Required-Stop:
+# Default-Start:     2 3 4 5
+# Default-Stop:      0 1 6
+# Short-Description: Nagios NDO2DB Initscript
+# Description: 	     Nagios Data Out Daemon
+### END INIT INFO
+#
+# $Id$
+
+# Source function library
+. /etc/rc.d/init.d/functions
+
+# Get network config
+. /etc/sysconfig/network
+
+# Check that networking is up.
+if is_yes "${NETWORKING}"; then
+	if [ ! -f /var/lock/subsys/network -a "$1" != stop -a "$1" != status ]; then
+		msg_network_down "Nagios NDO2DB"
+		exit 1
+	fi
+else
+	exit 0
+fi
+
+# Set defaults
+configfile=/etc/nagios/ndo2db.cfg
+pidfile=/var/lib/nagios/ndo2db.lock
+
+# Get service config - may override defaults
+[ -f /etc/sysconfig/ndo2db ] && . /etc/sysconfig/ndo2db
+
+start() {
+	# Check if the service is already running?
+	if [ -f /var/lock/subsys/ndo2db ]; then
+		msg_already_running "Nagios NDO2DB"
+		return
+	fi
+
+	msg_starting "Nagios NDO2DB"
+	touch $pidfile
+	chown nagios:nagios $pidfile
+	daemon /usr/sbin/ndo2db -c $configfile
+	RETVAL=$?
+	[ $RETVAL -eq 0 ] && touch /var/lock/subsys/ndo2db
+}
+
+stop() {
+	if [ ! -f /var/lock/subsys/ndo2db ]; then
+		msg_not_running "Nagios NDO2DB"
+		return
+	fi
+
+	# Stop daemons.
+	msg_stopping "Nagios NDO2DB"
+	killproc --pidfile $pidfile ndo2db -TERM
+	rm -f /var/lock/subsys/ndo2db
+}
+
+condrestart() {
+	if [ ! -f /var/lock/subsys/ndo2db ]; then
+		msg_not_running "Nagios NDO2DB"
+		RETVAL=$1
+		return
+	fi
+
+	stop
+	start
+}
+
+RETVAL=0
+# See how we were called.
+case "$1" in
+  start)
+	start
+	;;
+  stop)
+	stop
+	;;
+  restart)
+	stop
+	start
+	;;
+  try-restart)
+	condrestart 0
+	;;
+  force-reload)
+	condrestart 7
+	;;
+  status)
+	status --pidfile $pidfile ndo2db
+	RETVAL=$?
+	;;
+  *)
+	msg_usage "$0 {start|stop|restart|try-restart|force-reload|status}"
+	exit 3
+esac
+
+exit $RETVAL
================================================================

---- CVS-web:
    http://cvs.pld-linux.org/cgi-bin/cvsweb.cgi/packages/nagios-ndoutils/nagios-ndoutils.spec?r1=1.4&r2=1.5&f=u



More information about the pld-cvs-commit mailing list