summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatthew Thode <prometheanfire@gentoo.org>2018-10-14 13:38:17 -0500
committerMatthew Thode <prometheanfire@gentoo.org>2018-10-14 13:40:01 -0500
commite66a341ec02cfbb13ac0875fd0c2ea55a1212f09 (patch)
treeaba2fea4dce92477962f2adc64e673846005cef1 /net-analyzer/icinga2
parentgames-engines/odamex: EAPI-6 bump, sort stuff (diff)
downloadgentoo-e66a341ec02cfbb13ac0875fd0c2ea55a1212f09.tar.gz
gentoo-e66a341ec02cfbb13ac0875fd0c2ea55a1212f09.tar.bz2
gentoo-e66a341ec02cfbb13ac0875fd0c2ea55a1212f09.zip
net-analyzer/icinga2: update init script
Closes: https://bugs.gentoo.org/668506 Signed-off-by: Matthew Thode <prometheanfire@gentoo.org> Package-Manager: Portage-2.3.49, Repoman-2.3.11
Diffstat (limited to 'net-analyzer/icinga2')
-rw-r--r--net-analyzer/icinga2/files/icinga2.initd-391
-rw-r--r--net-analyzer/icinga2/icinga2-2.10.0-r1.ebuild (renamed from net-analyzer/icinga2/icinga2-2.10.0.ebuild)2
-rw-r--r--net-analyzer/icinga2/icinga2-9999.ebuild4
3 files changed, 94 insertions, 3 deletions
diff --git a/net-analyzer/icinga2/files/icinga2.initd-3 b/net-analyzer/icinga2/files/icinga2.initd-3
new file mode 100644
index 000000000000..46990e3e4e23
--- /dev/null
+++ b/net-analyzer/icinga2/files/icinga2.initd-3
@@ -0,0 +1,91 @@
+#!/sbin/openrc-run
+# Copyright 1999-2018 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+extra_started_commands="reload"
+
+# Set defaults, see /etc/conf.d/icinga2 to override
+: ${DAEMON:=/usr/sbin/icinga2}
+: ${ICINGA2_CONFIG_FILE:=/etc/icinga2/icinga2.conf}
+: ${ICINGA2_RUN_DIR:=/run/icinga2}
+: ${ICINGA2_STATE_DIR:=/var/cache/icinga2}
+: ${ICINGA2_PID_FILE:=${ICINGA2_RUN_DIR}/icinga2.pid}
+: ${ICINGA2_CMD_DIR:=${ICINGA2_RUN_DIR}/cmd}
+: ${ICINGA2_LOG_DIR:=/var/log/icinga2}
+: ${ICINGA2_ERROR_LOG:=/var/log/icinga2/error.log}
+: ${ICINGA2_STARTUP_LOG:=/var/log/icinga2/startup.log}
+: ${ICINGA2_LOG:=/var/log/icinga2/icinga2.log}
+: ${ICINGA2_CACHE_DIR:=/var/cache/icinga2}
+: ${ICINGA2_USER:=icinga}
+: ${ICINGA2_GROUP:=icingacmd}
+: ${ICINGA2_COMMAND_GROUP:=icingacmd}
+
+ICINGA2_DAEMON_ARGS="daemon -c $ICINGA2_CONFIG_FILE -e $ICINGA2_ERROR_LOG -d"
+
+depend() {
+ need net
+}
+
+checkconfig() {
+ if [ ! -e "$ICINGA2_CONFIG_FILE" ]; then
+ ewarn "Config file '$ICINGA2_CONFIG_FILE' does not exist."
+ eend 1
+ fi
+
+ ICINGA2_USER=$($DAEMON variable get RunAsUser)
+ if [ $? != 0 ]; then
+ eerror "Could not fetch RunAsUser variable: '$ICINGA2_USER'."
+ return 1
+ fi
+ ICINGA2_GROUP=$($DAEMON variable get RunAsGroup)
+ if [ $? != 0 ]; then
+ eerror "Could not fetch RunAsGroup variable: '$ICINGA2_GROUP'."
+ return 1
+ fi
+
+ checkpath -d -m 0750 -o $ICINGA2_USER:$ICINGA2_GROUP $ICINGA2_RUN_DIR
+ checkpath -d -m 0750 -o $ICINGA2_USER:$ICINGA2_GROUP $ICINGA2_STATE_DIR
+ checkpath -d -m 2750 -o $ICINGA2_USER:$ICINGA2_GROUP $ICINGA2_CMD_DIR
+
+ if ! $DAEMON daemon -c $ICINGA2_CONFIG_FILE -C > $ICINGA2_STARTUP_LOG 2>&1; then
+ eerror "Icinga2 detected configuration errors. Check '$ICINGA2_STARTUP_LOG' for details."
+ return 1
+ fi
+}
+
+start() {
+ checkconfig || return 1
+
+ ebegin "Starting icinga2"
+ start-stop-daemon --start --exec "${DAEMON}" \
+ --pidfile "${ICINGA2_PID_FILE}" \
+ -- $ICINGA2_DAEMON_ARGS > $ICINGA2_STARTUP_LOG 2>&1
+ local retval=$?
+ if [ $retval -ne 0 ]; then
+ ewarn "Error starting icinga2. '$ICINGA2_STARTUP_LOG' for details."
+ fi
+ eend $retval
+}
+
+stop() {
+ ebegin "Stopping icinga2"
+ start-stop-daemon \
+ --stop \
+ --pidfile $ICINGA2_PID_FILE \
+ --retry "SIGTERM/15 SIGKILL/30" \
+ --progress
+ eend $?
+}
+
+reload() {
+ checkconfig || return 1
+
+ ebegin "Reloading icinga2"
+ start-stop-daemon --signal HUP --pidfile "$ICINGA2_PID_FILE"
+
+ local retval=$?
+ if [ $retval -ne 0 ]; then
+ ewarn "Error reloading icinga2."
+ fi
+ eend $retval
+}
diff --git a/net-analyzer/icinga2/icinga2-2.10.0.ebuild b/net-analyzer/icinga2/icinga2-2.10.0-r1.ebuild
index e5caea793dd7..913217ef694f 100644
--- a/net-analyzer/icinga2/icinga2-2.10.0.ebuild
+++ b/net-analyzer/icinga2/icinga2-2.10.0-r1.ebuild
@@ -109,7 +109,7 @@ src_install() {
einstalldocs
- newinitd "${FILESDIR}"/icinga2.initd-2 icinga2
+ newinitd "${FILESDIR}"/icinga2.initd-3 icinga2
if use mysql ; then
docinto schema
diff --git a/net-analyzer/icinga2/icinga2-9999.ebuild b/net-analyzer/icinga2/icinga2-9999.ebuild
index c0f291e4ea22..913217ef694f 100644
--- a/net-analyzer/icinga2/icinga2-9999.ebuild
+++ b/net-analyzer/icinga2/icinga2-9999.ebuild
@@ -1,4 +1,4 @@
-# Copyright 1999-2018 Gentoo Foundation
+# Copyright 1999-2018 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2
EAPI=6
@@ -109,7 +109,7 @@ src_install() {
einstalldocs
- newinitd "${FILESDIR}"/icinga2.initd-2 icinga2
+ newinitd "${FILESDIR}"/icinga2.initd-3 icinga2
if use mysql ; then
docinto schema