Skip to contentSkip to conversation

rsyslog: fix configuration file for logrotate

PATCH New [email protected] 1 participant 1 message Jul 30, 2018

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 rsyslog: fix configuration file for logrotate

From: Chen Qi <[email protected]>

The logrotate.rsyslog file uses 'cat /var/run/rsyslogd.pid' to determine the pid of rsyslogd daemon. This is incorrect, because rsyslogd may start in a way that does not create rsyslog.pid file.

Failing to send HUP signal to rsyslogd daemon will result in unexpected behaviour. e.g. rsyslogd is writing to /var/log/messages-xxxx instead of /var/log/messages.

We should really use pkill to send HUP signal to rsyslogd to ensure correct behaviour.

---
 meta-oe/recipes-extended/rsyslog/rsyslog/rsyslog.logrotate | 4 ++--
 meta-oe/recipes-extended/rsyslog/rsyslog_8.36.0.bb         | 1 +
 2 files changed, 3 insertions(+), 2 deletions(-)
meta-oe/recipes-extended/rsyslog/rsyslog/rsyslog.logrotate +2 -2
index 94ec517..5f8568f 100644
@@ -9,7 +9,7 @@
         delaycompress
         compress
         postrotate
-		/bin/kill -HUP `cat /var/run/rsyslogd.pid 2> /dev/null` 2> /dev/null || true
+		@BINDIR@/pkill -HUP rsyslogd 2> /dev/null || true
         endscript
 }
 
@@ -34,6 +34,6 @@
         delaycompress
         sharedscripts
         postrotate
-		/bin/kill -HUP `cat /var/run/rsyslogd.pid 2> /dev/null` 2> /dev/null || true
+		@BINDIR@/pkill -HUP rsyslogd 2> /dev/null || true
         endscript
 }
meta-oe/recipes-extended/rsyslog/rsyslog_8.36.0.bb +1 -0
index 9737892..d90695a 100644
@@ -125,6 +125,7 @@ do_install_append() {
     install -m 755 ${WORKDIR}/initscript ${D}${sysconfdir}/init.d/syslog
     install -m 644 ${WORKDIR}/rsyslog.conf ${D}${sysconfdir}/rsyslog.conf
     install -m 644 ${WORKDIR}/rsyslog.logrotate ${D}${sysconfdir}/logrotate.d/logrotate.rsyslog
+    sed -i -e "s#@BINDIR@#${bindir}#g" ${D}${sysconfdir}/logrotate.d/logrotate.rsyslog
 }
 
 FILES_${PN} += "${bindir}"
Signature · 1 line
1.9.1