From 71cfa42731a197b676f8c1c7dc20b191733673f3 Mon Sep 17 00:00:00 2001 From: Michael Friedrich Date: Fri, 22 Sep 2017 09:31:05 +0200 Subject: [PATCH] Ensure that the cache directory always is set and add a note to upgrading docs Thanks @dgoetz refs #5601 --- doc/16-upgrading-icinga-2.md | 16 ++++++++++++++++ etc/initsystem/prepare-dirs | 4 ++++ 2 files changed, 20 insertions(+) diff --git a/doc/16-upgrading-icinga-2.md b/doc/16-upgrading-icinga-2.md index bd2134e83..b5dc519c4 100644 --- a/doc/16-upgrading-icinga-2.md +++ b/doc/16-upgrading-icinga-2.md @@ -12,6 +12,22 @@ In case are having troubles with OpenSSL 1.1.0 and the public CA certificates, please read [this advisory](https://www.icinga.com/2017/08/30/advisory-for-ssl-problems-with-leading-zeros-on-openssl-1-1-0/) and check the [troubleshooting chapter](15-troubleshooting.md#troubleshooting). +If Icinga 2 fails to start with an empty reference to `$ICINGA2_CACHE_DIR` +ensure to set it inside `/etc/sysconfig/icinga2` (RHEL) or `/etc/default/icinga2` (Debian). + +RPM packages will put a file called `/etc/sysconfig/icinga2.rpmnew` +if you have modified the original file. + +Example on CentOS 7: + +``` +vim /etc/sysconfig/icinga2 + +ICINGA2_CACHE_DIR=/var/cache/icinga2 + +systemctl restart icinga2 +``` + ## Upgrading the MySQL database If you're upgrading an existing Icinga 2 instance, you should check the diff --git a/etc/initsystem/prepare-dirs b/etc/initsystem/prepare-dirs index cb6ddbec0..5d67d476d 100644 --- a/etc/initsystem/prepare-dirs +++ b/etc/initsystem/prepare-dirs @@ -52,6 +52,10 @@ if type restorecon >/dev/null 2>&1; then fi chmod 2750 $ICINGA2_RUN_DIR/icinga2/cmd +# Add a fallback if the user did not specify this directory in the sysconfig file +if [ -z "$ICINGA2_CACHE_DIR" ]; then + ICINGA2_CACHE_DIR=$ICINGA2_STATE_DIR/cache/icinga2 +fi mkdir -p $ICINGA2_CACHE_DIR chown $ICINGA2_USER:$ICINGA2_GROUP $ICINGA2_CACHE_DIR chmod 750 $ICINGA2_CACHE_DIR