[omd-commits] OMD Git: omd: omd: add a README to the init-hooks.d directory
git version control
git at mathias-kettner.de
Sun May 20 23:24:55 CEST 2012
Module: omd
Branch: master
Commit: fb91c65a4c234a0cd2f29b5d593000e11f896a5f
URL: http://omdistro.org/projects/omd/repository/revisions/fb91c65a4c234a0cd2f29b5d593000e11f896a5f
Author: Gerhard Lausser <gerhard.lausser at consol.de>
Date: Sun May 20 23:24:07 2012 +0200
Commiter: Gerhard Lausser <gerhard.lausser at consol.de>
Date: Sun May 20 23:24:07 2012 +0200
omd: add a README to the init-hooks.d directory
---
packages/apache-omd/skel/etc/init.d/apache | 4 +++-
packages/icinga/skel/etc/init.d/icinga | 2 +-
packages/nagios/skel/etc/init.d/nagios | 2 +-
packages/omd/skel/.profile | 2 +-
packages/omd/skel/etc/init-hooks.d/README | 22 +++++++++++++++++++++-
packages/shinken/skel/etc/init.d/shinken | 2 +-
6 files changed, 28 insertions(+), 6 deletions(-)
diff --git a/packages/apache-omd/skel/etc/init.d/apache b/packages/apache-omd/skel/etc/init.d/apache
index 39159ef..70fb4a9 100644
--- a/packages/apache-omd/skel/etc/init.d/apache
+++ b/packages/apache-omd/skel/etc/init.d/apache
@@ -1,5 +1,7 @@
#!/bin/bash
+cd ###ROOT###
+. ###ROOT###/.profile
. ###ROOT###/etc/omd/site.conf
if [ "$CONFIG_APACHE_MODE" != own ] ; then
exit 5
@@ -112,7 +114,7 @@ kill_stale_php_cgis()
done
}
-init-hook $0 $1 pre
+__init_hook $0 $1 pre
case $1 in
start)
echo -n "Starting dedicated Apache for site ###SITE###..."
diff --git a/packages/icinga/skel/etc/init.d/icinga b/packages/icinga/skel/etc/init.d/icinga
index 7bf4947..0fa3f4f 100755
--- a/packages/icinga/skel/etc/init.d/icinga
+++ b/packages/icinga/skel/etc/init.d/icinga
@@ -180,7 +180,7 @@ case "$1" in start|restart|reload|checkconfig)
fi
esac
-init-hook $0 $1 pre
+__init_hook $0 $1 pre
case "$1" in
start)
echo -n "Starting icinga..."
diff --git a/packages/nagios/skel/etc/init.d/nagios b/packages/nagios/skel/etc/init.d/nagios
index 5ad795d..1a8aa63 100755
--- a/packages/nagios/skel/etc/init.d/nagios
+++ b/packages/nagios/skel/etc/init.d/nagios
@@ -161,7 +161,7 @@ case "$1" in start|restart|reload|checkconfig)
fi
esac
-init-hook $0 $1 pre
+__init_hook $0 $1 pre
case "$1" in
start)
echo -n "Starting nagios..."
diff --git a/packages/omd/skel/.profile b/packages/omd/skel/.profile
index 3a38c41..77dfb5c 100644
--- a/packages/omd/skel/.profile
+++ b/packages/omd/skel/.profile
@@ -26,7 +26,7 @@ if [ "$BASH" -a -s ~/.bashrc -a -z "$BASHRC" ]; then
. ~/.bashrc
fi
-function init-hook() {
+__init_hook() {
# Takes 3 parameters
# 1. Name of the init-script (can be the full path name, we will only use the file part)
# 2. The command the init-script was called with (start, stop, reload,..)
diff --git a/packages/omd/skel/etc/init-hooks.d/README b/packages/omd/skel/etc/init-hooks.d/README
index c8acb73..89fa3d1 100644
--- a/packages/omd/skel/etc/init-hooks.d/README
+++ b/packages/omd/skel/etc/init-hooks.d/README
@@ -1 +1,21 @@
-In this directory you can put blabla
+In this directory you can put your own custom scripts which extend the startstop-scripts in etc/init.d
+
+The init-hook-scripts are executed by the init-scripts before or after a certain operation. This is defined by following a naming scheme.
+
+<name of the init-script>-<name of the operation>-<pre or post>
+
+Example:
+nagios-reload-pre will be executed when you run "etc/init.d/nagios reload" or "omd reload nagios" just before the actual reload.
+
+
+Real-live use case:
+Imagine your etc/nagios/conf.d/myconfig is the clone of a git repository. Whenever you reload Nagios, the init-hook-script will do a
+cd etc/nagios/conf.d/myconfig
+git pull
+and update the config files from the central repository. Then the actual reload follows.
+
+Currently only the following scripts can be used, all others are ignored:
+nagios-*-pre
+shinken-*-pre
+icinga-*-pre
+apache-*-pre
diff --git a/packages/shinken/skel/etc/init.d/shinken b/packages/shinken/skel/etc/init.d/shinken
index 9a1e5af..fc183a8 100644
--- a/packages/shinken/skel/etc/init.d/shinken
+++ b/packages/shinken/skel/etc/init.d/shinken
@@ -427,7 +427,7 @@ do_check() {
#
# check for our command
#
-init-hook $0 $1 pre
+__init_hook $0 $1 pre
case "$CMD" in
start)
[ "$VERBOSE" != no ] && echo "Starting $NAME..."
More information about the omd-commits
mailing list