[icinga-checkins] icinga.org: icinga-core/r1.2: install: add sysconfig source to init script #1015

git at icinga.org git at icinga.org
Thu Jan 13 15:57:29 CET 2011


Module: icinga-core
Branch: r1.2
Commit: 8cebe4cfbcc300d175ce89b4d86c9500a478ad80
URL:    https://git.icinga.org/?p=icinga-core.git;a=commit;h=8cebe4cfbcc300d175ce89b4d86c9500a478ad80

Author: Michael Friedrich <michael.friedrich at univie.ac.at>
Date:   Wed Nov 24 09:01:08 2010 +0100

install: add sysconfig source to init script #1015

fixes #1015

---

 Changelog      |    2 +
 daemon-init.in |   83 +++++++++++++++++++++++++-------------------
 rc.ido2db.in   |  106 ++++++++++++++++++++++++++++----------------------------
 3 files changed, 102 insertions(+), 89 deletions(-)

diff --git a/Changelog b/Changelog
index afa0031..d069ef5 100644
--- a/Changelog
+++ b/Changelog
@@ -16,6 +16,8 @@ ENHANCEMENTS
 * classic ui: change displayed name for hostgroups and servicegroups in extinfo.cgi
 * classic ui: adding "Attempt" column to host status detail list
 
+* install: add sysconfig source to init script #1015
+
 * idoutils: add index to table icinga_statehistory for usage in reporting module #957
 
 FIXES
diff --git a/daemon-init.in b/daemon-init.in
index 19f5846..1477d8c 100644
--- a/daemon-init.in
+++ b/daemon-init.in
@@ -12,6 +12,51 @@
 # Description: Icinga is a service monitoring system
 ### END INIT INFO
 
+## definitions ##
+prefix=@prefix@
+exec_prefix=@exec_prefix@
+IcingaBin=@bindir@/icinga
+IcingaCfgFile=@sysconfdir@/icinga.cfg
+IcingaStatusFile=@localstatedir@/status.dat
+IcingaRetentionFile=@localstatedir@/retention.dat
+IcingaCommandFile=@localstatedir@/rw/icinga.cmd
+IcingaVarDir=@localstatedir@
+IcingaRunFile=@lockfile@
+IcingaLockDir=/var/lock/subsys
+IcingaLockFile=icinga
+IcingaUser=@icinga_user@
+IcingaGroup=@icinga_grp@
+IcingaChkFile=@localstatedir@/icinga.chk
+
+# load extra environment variables
+if [ -f /etc/sysconfig/icinga ]; then
+        . /etc/sysconfig/icinga
+fi
+
+
+# Source function library
+# Solaris doesn't have an rc.d directory, so do a test first
+if [ -f /etc/rc.d/init.d/functions ]; then
+        . /etc/rc.d/init.d/functions
+elif [ -f /etc/init.d/functions ]; then
+        . /etc/init.d/functions
+fi
+
+# Check that icinga exists.
+if [ ! -f $IcingaBin ]; then
+    echo "Executable file $IcingaBin not found.  Exiting."
+    exit 1
+fi
+
+# Check that icinga.cfg exists.
+if [ ! -f $IcingaCfgFile ]; then
+    echo "Configuration file $IcingaCfgFile not found.  Exiting."
+    exit 1
+fi
+
+
+## helper functions ##
+
 status_icinga ()
 {
 
@@ -74,42 +119,6 @@ chk_config ()
 	#exit 0
 }
 
-# Source function library
-# Solaris doesn't have an rc.d directory, so do a test first
-if [ -f /etc/rc.d/init.d/functions ]; then
-	. /etc/rc.d/init.d/functions
-elif [ -f /etc/init.d/functions ]; then
-	. /etc/init.d/functions
-fi
-
-prefix=@prefix@
-exec_prefix=@exec_prefix@
-IcingaBin=@bindir@/icinga
-IcingaCfgFile=@sysconfdir@/icinga.cfg
-IcingaStatusFile=@localstatedir@/status.dat
-IcingaRetentionFile=@localstatedir@/retention.dat
-IcingaCommandFile=@localstatedir@/rw/icinga.cmd
-IcingaVarDir=@localstatedir@
-IcingaRunFile=@lockfile@
-IcingaLockDir=/var/lock/subsys
-IcingaLockFile=icinga
-IcingaUser=@icinga_user@
-IcingaGroup=@icinga_grp@
-IcingaChkFile=@localstatedir@/icinga.chk
-
-
-# Check that icinga exists.
-if [ ! -f $IcingaBin ]; then
-    echo "Executable file $IcingaBin not found.  Exiting."
-    exit 1
-fi
-
-# Check that icinga.cfg exists.
-if [ ! -f $IcingaCfgFile ]; then
-    echo "Configuration file $IcingaCfgFile not found.  Exiting."
-    exit 1
-fi
-
 start(){
 	# Check if icinga is already running
 	$0 status > /dev/null
@@ -136,6 +145,8 @@ start(){
 
 }
 
+
+## MAIN ##
 # See how we were called.
 case "$1" in
 
diff --git a/rc.ido2db.in b/rc.ido2db.in
index c92dbb2..6361d76 100644
--- a/rc.ido2db.in
+++ b/rc.ido2db.in
@@ -1,9 +1,9 @@
 #!/bin/sh
-# 
+#
 ### BEGIN INIT INFO
 # Provides:          ido2db
-# Required-Start:    
-# Required-Stop:     
+# Required-Start:
+# Required-Stop:
 # Default-Start:     2 3 4 5
 # Default-Stop:      0 1 6
 # Short-Description: Icinga IDO2DB Initscript
@@ -15,7 +15,7 @@
 # File : ido2db
 #
 # Author : Jorge Sanchez Aymar (jsanchez at lanchile.cl)
-# 
+#
 # Changelog :
 #
 # 1999-07-09 Karl DeBisschop <kdebisschop at infoplease.com>
@@ -37,7 +37,53 @@
 #  - Rewrite ido2db init script, inspired by Sascha Runschke
 #
 #
-  
+
+servicename=@ido2db_name@
+prefix=@prefix@
+exec_prefix=${prefix}
+Ido2dbBin=@bindir@/@ido2db_name@
+Ido2dbCfgFile=@sysconfdir@/ido2db.cfg
+Ido2dbVarDir=@localstatedir@
+Ido2dbRunFile=$Ido2dbVarDir/ido2db.lock
+Ido2dbLockDir=/var/lock/subsys
+Ido2dbLockFile=@ido2db_name@
+Ido2dbUser=@icinga_user@
+Ido2dbGroup=@icinga_grp@
+
+#add ocilib lib path to link at runtime if enabled
+LD_LIBRARY_PATH=$LD_LIBRARY_PATH:@ido2db_runtime@
+export LD_LIBRARY_PATH
+
+
+# load extra environment variables
+if [ -f /etc/sysconfig/ido2db ]; then
+        . /etc/sysconfig/ido2db
+fi
+
+
+# Source function library
+# Solaris doesn't have an rc.d directory, so do a test first
+if [ -f /etc/rc.d/init.d/functions ]; then
+        . /etc/rc.d/init.d/functions
+elif [ -f /etc/init.d/functions ]; then
+        . /etc/init.d/functions
+fi
+
+
+# Check that ido2db exists.
+if [ ! -f $Ido2dbBin ]; then
+    echo "Executable file $Ido2dbBin not found.  Exiting."
+    exit 1
+fi
+
+# Check that ido2db.cfg exists.
+if [ ! -f $Ido2dbCfgFile ]; then
+    echo "Configuration file $Ido2dbCfgFile not found.  Exiting."
+    exit 1
+fi
+
+## helper functions ##
+
 status_ido2db ()
 {
 
@@ -81,53 +127,7 @@ pid_ido2db ()
 	Ido2dbPID=`head -n 1 $Ido2dbRunFile`
 }
 
-#checkpid_ido2db() {
-#        local i
-#
-#        for i in $* ; do
-#                [ -d "/proc/$i" ] && return 0
-#        done
-#        return 1
-#}
-
-
-
-# Source function library
-# Solaris doesn't have an rc.d directory, so do a test first
-if [ -f /etc/rc.d/init.d/functions ]; then
-	. /etc/rc.d/init.d/functions
-elif [ -f /etc/init.d/functions ]; then
-	. /etc/init.d/functions
-fi
-
-servicename=@ido2db_name@
-prefix=@prefix@
-exec_prefix=${prefix}
-Ido2dbBin=@bindir@/@ido2db_name@
-Ido2dbCfgFile=@sysconfdir@/ido2db.cfg
-Ido2dbVarDir=@localstatedir@
-Ido2dbRunFile=$Ido2dbVarDir/ido2db.lock
-Ido2dbLockDir=/var/lock/subsys
-Ido2dbLockFile=@ido2db_name@
-Ido2dbUser=@icinga_user@
-Ido2dbGroup=@icinga_grp@
-
-#add ocilib lib path to link at runtime if enabled
-LD_LIBRARY_PATH=$LD_LIBRARY_PATH:@ido2db_runtime@
-export LD_LIBRARY_PATH
-
-# Check that ido2db exists.
-if [ ! -f $Ido2dbBin ]; then
-    echo "Executable file $Ido2dbBin not found.  Exiting."
-    exit 1
-fi
-
-# Check that ido2db.cfg exists.
-if [ ! -f $Ido2dbCfgFile ]; then
-    echo "Configuration file $Ido2dbCfgFile not found.  Exiting."
-    exit 1
-fi
-          
+## MAIN ##
 # See how we were called.
 case "$1" in
 
@@ -157,7 +157,7 @@ case "$1" in
 	stop)
 		printf "Stopping $servicename: "
 
-		pid_ido2db 
+		pid_ido2db
 		killproc_ido2db ido2db
 
  		# now we have to wait for ido2db to exit and remove its





More information about the icinga-checkins mailing list