From afc541830b7d3b7f19554b45817d68527ececc2b Mon Sep 17 00:00:00 2001 From: Fredrik Eriksson Date: Sun, 17 May 2020 15:56:43 +0200 Subject: [PATCH] added missing rc script for icinga2 --- net-analyzer/icinga2/Manifest | 1 + net-analyzer/icinga2/files/icinga2.initd-3 | 81 ++++++++++++++++++++++ 2 files changed, 82 insertions(+) create mode 100644 net-analyzer/icinga2/files/icinga2.initd-3 diff --git a/net-analyzer/icinga2/Manifest b/net-analyzer/icinga2/Manifest index b1e5773..e88e0bd 100644 --- a/net-analyzer/icinga2/Manifest +++ b/net-analyzer/icinga2/Manifest @@ -1,2 +1,3 @@ +AUX icinga2.initd-3 2390 BLAKE2B 1ead1dd958d978324dfa043abcc58be7ed389207e2bf4dc4786bd2705f94c70a03b84f34a55435f6d9dfcc0483e35da60c1f536dec1060bdc232108c622e0615 SHA512 a43911717fe891e70690647daa57426f70d10f9cb02c721962be4c13cfe8a95bc3ff84b9ba2a293adafc8ddacf8ea6771bd66e7ff6dabe3e732176bf6e6e474a DIST icinga2-2.11.3.tar.gz 7475785 BLAKE2B baabe8c90170a7b2ddb3ae7e95ef3cd042e64f68dbfdb50f5a981bc63ae5aa1e8ec4082729456d1b3fc02c0c74a98e15383cc56e56c53a2ab6181db94125365c SHA512 616e938fabaa6565fb9ac4824649c09801dd53b3517c0a9b5b62307293bc838377c18818cc13dd40e240902f02455c421d433b6ee54671403598c5b7aeb78ea1 EBUILD icinga2-2.11.3.ebuild 4615 BLAKE2B 15e2025925303b103de145a66ba3a04881cf6957e0f0ff6fcf5082ec5b47180cb06dcbc2f14dcf2bd9f0d1735c532a0980bb1d03f6ede46af07fdf7c3d064dff SHA512 2b365a8c1e5a14c528ea572e19a498f56389c32141a7e64d7e2af07095880986bc889fbc6a4b32ed1c71180b08579720c5bcfd6ec7ffd99abfa17fe8e59cb1a6 diff --git a/net-analyzer/icinga2/files/icinga2.initd-3 b/net-analyzer/icinga2/files/icinga2.initd-3 new file mode 100644 index 0000000..5af259d --- /dev/null +++ b/net-analyzer/icinga2/files/icinga2.initd-3 @@ -0,0 +1,81 @@ +#!/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 + + 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 + checkpath -d -m 0750 -o $ICINGA2_USER:$ICINGA2_GROUP $ICINGA2_CACHE_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 +}