From 66e1d17d2815f18758e2ef54dcd70484adddc4d7 Mon Sep 17 00:00:00 2001 From: Jarrod Johnson Date: Thu, 6 Feb 2020 13:45:46 -0500 Subject: [PATCH] Have systemd manage confluent run dir The run directory has to be created and owned by confluent, or else things cannot start. --- confluent_server/confluent_server.spec.tmpl | 6 +++--- confluent_server/systemd/confluent.service | 5 +++++ 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/confluent_server/confluent_server.spec.tmpl b/confluent_server/confluent_server.spec.tmpl index e65cfe5b..1306fb5f 100644 --- a/confluent_server/confluent_server.spec.tmpl +++ b/confluent_server/confluent_server.spec.tmpl @@ -55,8 +55,8 @@ true %pre getent group confluent > /dev/null || /usr/sbin/groupadd -r confluent getent passwd confluent > /dev/null || /usr/sbin/useradd -r -g confluent -d /var/lib/confluent -s /sbin/nologin confluent -mkdir -p /etc/confluent /var/lib/confluent /var/run/confluent /var/log/confluent /var/cache/confluent -chown -R confluent:confluent /etc/confluent /var/lib/confluent /var/run/confluent /var/log/confluent /var/cache/confluent +mkdir -p /etc/confluent /var/lib/confluent /var/log/confluent /var/cache/confluent +chown -R confluent:confluent /etc/confluent /var/lib/confluent /var/log/confluent /var/cache/confluent %post sysctl -p /usr/lib/sysctl.d/confluent.conf >& /dev/null @@ -71,7 +71,7 @@ if [ $NEEDCHOWN = 1 ]; then NEEDSTART=1 systemctl stop confluent fi - chown -R confluent:confluent /etc/confluent /var/lib/confluent /var/run/confluent /var/log/confluent /var/cache/confluent + chown -R confluent:confluent /etc/confluent /var/lib/confluent /var/log/confluent /var/cache/confluent fi systemctl daemon-reload if systemctl is-active confluent > /dev/null || [ $NEEDSTART = 1 ]; then /usr/bin/systemctl restart confluent >& /dev/null; fi diff --git a/confluent_server/systemd/confluent.service b/confluent_server/systemd/confluent.service index 199d9973..3ecf1e11 100644 --- a/confluent_server/systemd/confluent.service +++ b/confluent_server/systemd/confluent.service @@ -6,6 +6,11 @@ Description=Confluent hardware manager [Service] Type=forking #PIDFile=/var/run/confluent/pid +RuntimeDirectory=confluent +StateDirectory=confluent +CacheDirectory=confluent +LogsDirectory=confluent +ConfigurationDirectory=confluent ExecStart=/opt/confluent/bin/confluent ExecStop=/opt/confluent/bin/confetty shutdown / Restart=on-failure