From 230e7757a7805c7c530d0914936f353882bd504e Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Alejandro=20L=C3=B3pez?= <allopez@redhat.com>
Date: Fri, 10 Nov 2023 14:07:49 +0100
Subject: [PATCH] LOGROTATE: logrotate should also signal sssd_kcm
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

sssd_kcm is not registered with SSSD's monitor, so it is not signaled
when it must restart the log. Adding this command will directly signal
sssd_kcm (in addition to the monitor).

If sssd_kcm is also running in one or more containers, they will also
receive the signal. Because only the log files in the host where rotated,
the instances in the containers will go on using the same log files.
Nothing will happen except for the "Received SIGHUP. Rotating logfiles."
message in the log files. If we want to avoid this, we should implement
a PID file.

Reviewed-by: Sumit Bose <sbose@redhat.com>
Reviewed-by: Tomáš Halman <thalman@redhat.com>
---
 contrib/sssd.spec.in   | 1 +
 src/examples/logrotate | 3 ++-
 2 files changed, 3 insertions(+), 1 deletion(-)

diff --git a/src/examples/logrotate b/src/examples/logrotate
index ecf0c6102..6e769451c 100644
--- a/src/examples/logrotate
+++ b/src/examples/logrotate
@@ -7,6 +7,7 @@
     compress
     delaycompress
     postrotate
-        /bin/kill -HUP `cat /var/run/sssd.pid  2>/dev/null`  2> /dev/null || true
+        /bin/kill -HUP `cat /var/run/sssd.pid 2>/dev/null` 2> /dev/null || true
+        /bin/pkill -HUP sssd_kcm 2> /dev/null || true
     endscript
 }
-- 
2.33.0

