summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatthew Thode <prometheanfire@gentoo.org>2012-08-19 04:43:25 +0000
committerMatthew Thode <prometheanfire@gentoo.org>2012-08-19 04:43:25 +0000
commita2c2f4703cb22ea3e947cd16045379fe97d5f1ff (patch)
treed3160ce509efc957f8c26d23b91f67f9699f3f4e /net-analyzer/icinga/files
parentRemove old; keep it to sysadmin herd, drop me. (diff)
downloadgentoo-2-a2c2f4703cb22ea3e947cd16045379fe97d5f1ff.tar.gz
gentoo-2-a2c2f4703cb22ea3e947cd16045379fe97d5f1ff.tar.bz2
gentoo-2-a2c2f4703cb22ea3e947cd16045379fe97d5f1ff.zip
cleanup and new init, thanks flameeyes :D
(Portage version: 2.1.10.65/cvs/Linux x86_64)
Diffstat (limited to 'net-analyzer/icinga/files')
-rwxr-xr-xnet-analyzer/icinga/files/icinga-init.d-261
-rw-r--r--net-analyzer/icinga/files/ido2db-init.d-238
2 files changed, 99 insertions, 0 deletions
diff --git a/net-analyzer/icinga/files/icinga-init.d-2 b/net-analyzer/icinga/files/icinga-init.d-2
new file mode 100755
index 000000000000..85f64ad554dd
--- /dev/null
+++ b/net-analyzer/icinga/files/icinga-init.d-2
@@ -0,0 +1,61 @@
+#!/sbin/runscript
+# Copyright 1999-2012 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: /var/cvsroot/gentoo-x86/net-analyzer/icinga/files/icinga-init.d-2,v 1.7 2012/08/19 04:43:25 prometheanfire Exp $
+
+: ${ICINGACFG:=/etc/icinga/icinga.cfg}
+
+extra_commands="checkconfig"
+extra_started_commands="reload"
+
+command=/usr/sbin/icinga
+command_args="-d ${ICINGACFG}"
+
+get_config() {
+ sed -n -e 's:^[ \t]*'$1'=\([^#]\+\).*:\1:p' \
+ "${ICINGACFG}"
+}
+
+pidfile=$(get_config lock_file)
+start_stop_daemon_args="-e HOME=/var/lib/icinga"
+
+depend() {
+ need net
+ use dns logger firewall mysql postgresql ido2db
+}
+
+checkconfig() {
+ # Silent Check
+ ${command} -v ${ICINGACFG} &>/dev/null && return 0
+ # Now we know there's problem - run again and display errors
+ ${command} -v ${ICINGACFG}
+ eend $? "Configuration Error. Please fix your configfile"
+}
+
+reload()
+{
+ checkconfig || return 1
+ ebegin "Reloading configuration"
+ kill -HUP $(cat ${pidfile}) &>/dev/null
+ eend $?
+}
+
+start_pre() {
+ checkpath -d -o icinga:icinga $(get_config temp_path) $(dirname $(get_config lock_file)) $(dirname $(get_config log_file)) $(dirname $(get_config status_file))
+ checkpath -f -o icinga:icinga $(get_config log_file)
+ rm -f $(get_config command_file)
+}
+
+stop_post() {
+ rm -f $(get_config command_file)
+ rm -r /tmp/icinga
+}
+
+svc_restart() {
+ checkconfig || return 1
+ ebegin "Restarting icinga"
+ svc_stop
+ svc_start
+ eend $?
+}
+
diff --git a/net-analyzer/icinga/files/ido2db-init.d-2 b/net-analyzer/icinga/files/ido2db-init.d-2
new file mode 100644
index 000000000000..74ca1c286ac3
--- /dev/null
+++ b/net-analyzer/icinga/files/ido2db-init.d-2
@@ -0,0 +1,38 @@
+#!/sbin/runscript
+# Copyright 1999-2012 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: /var/cvsroot/gentoo-x86/net-analyzer/icinga/files/ido2db-init.d-2,v 1.1 2012/08/19 04:43:25 prometheanfire Exp $
+
+get_config() {
+ sed -n -e 's:^[ \t]*'$1'=\([^#]\+\).*:\1:p' \
+ "${IDO2DBCFG}"
+}
+
+command=/usr/sbin/ido2db
+command_args="-c ${IDO2DBCFG}"
+pidfile="$(get_config lock_file)"
+
+depend() {
+ config "${IDO2DBCFG}"
+
+ need net
+ use dns logger firewall
+
+ case $(get_config db_servertype) in
+ mysql)
+ need mysql ;;
+ pgsql)
+ need postgresql ;;
+ esac
+}
+
+IDO2DBSOCKET="$(get_config socket_name)"
+
+start_pre() {
+ if [ -S "${IDO2DBSOCKET}" ] ; then
+ ewarn "Strange, the socket file already exist in \"${IDO2DBSOCKET}\""
+ ewarn "it will be removed now and re-created by ido2db"
+ ewarn "BUT please make your checks."
+ rm -f "${IDO2DBSOCKET}"
+ fi
+}