[Pkg-nagios-changes] [SCM] debian packaging of icinga(-core) branch, master, updated. debian/1.6.1-2-22-gc1c3991
Alexander Wirt
formorer at debian.org
Fri May 4 19:11:31 UTC 2012
The following commit has been merged in the master branch:
commit b6bba3b4d85adaa898e6962199c917e83acfce14
Author: Alexander Wirt <formorer at debian.org>
Date: Tue Apr 24 08:40:11 2012 +0200
Remove stale socket on daemon startup and start idoutils before icinga
Closes: #670201, #663678
diff --git a/debian/icinga-idoutils.ido2db.init b/debian/icinga-idoutils.ido2db.init
index 9d8b4b2..4c35da3 100644
--- a/debian/icinga-idoutils.ido2db.init
+++ b/debian/icinga-idoutils.ido2db.init
@@ -1,8 +1,10 @@
#! /bin/sh
### BEGIN INIT INFO
# Provides: ido2db
-# Required-Start: $remote_fs $syslog $named $network $time icinga
+# Required-Start: $remote_fs $syslog $named $network $time
# Required-Stop: $remote_fs $syslog $named $network
+# X-Start-Before: icinga
+# X-Stop-After: icinga
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: ido2db initscript
@@ -41,6 +43,35 @@ if [ "$IDO2DB" != "yes" ]; then
exit 0
fi
+
+check_started () {
+ start-stop-daemon --start --quiet --pidfile $PIDFILE --exec $DAEMON --test > /dev/null \
+ || return 1
+}
+
+cleanup_socket () {
+ SOCKET=$( get_config socket_name )
+ test -z "$SOCKET" && return
+ check_started || test -S $SOCKET && rm $SOCKET
+}
+
+#
+# get_config()
+#
+# grab a config option from icinga.cfg (or possibly another icinga config
+# file if specified). everything after the '=' is echo'd out, making
+# this a nice generalized way to get requested settings.
+#
+get_config () {
+ if [ "$2" ]; then
+ set -- `grep ^$1 $2 | sed 's@=@ @'`
+ else
+ set -- `grep ^$1 $CFG | sed 's@=@ @'`
+ fi
+ shift
+ echo $*
+}
+
#
# Function that starts the daemon/service
#
@@ -48,6 +79,8 @@ do_start()
{
test -d $(dirname $PIDFILE) || mkdir -p $(dirname $PIDFILE)
chown nagios:nagios $(dirname $PIDFILE)
+ #cleanup stale socket
+ cleanup_socket
# Return
# 0 if daemon has been started
# 1 if daemon was already running
@@ -85,6 +118,7 @@ do_stop()
return "$RETVAL"
}
+
case "$1" in
start)
[ "$VERBOSE" != no ] && log_daemon_msg "Starting $DESC" "$NAME"
--
debian packaging of icinga(-core)
More information about the Pkg-nagios-changes
mailing list