From d2f8a82fe32a9eea85e11c378dd0f27ac9f140ca Mon Sep 17 00:00:00 2001 From: Donald Buczek Date: Thu, 17 Oct 2019 11:18:47 +0200 Subject: [PATCH] logrotate: Don't fail when syslog not running Avoid error logrotate[225]: dateext suffix '.2019-10' logrotate[225]: glob pattern '.[0-9][0-9][0-9][0-9]-[0-9][0-9]' logrotate[225]: renaming /var/log/messages to /var/log/messages.2019-10 logrotate[225]: running postrotate script logrotate[225]: cat: /var/run/rsyslogd.pid: No such file or directory logrotate[225]: kill: usage: kill [-s sigspec | -n signum | -sigspec] pid | jobspec ... o logrotate[225]: error: error running shared postrotate script for '/var/log/messages ' systemd[1]: logrotate.service: Main process exited, code=exited, status=1/FAILURE systemd[1]: logrotate.service: Failed with result 'exit-code'. systemd[1]: Failed to start Rotate log files. --- logrotate/logrotate.conf | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/logrotate/logrotate.conf b/logrotate/logrotate.conf index b319fa0..9974d20 100644 --- a/logrotate/logrotate.conf +++ b/logrotate/logrotate.conf @@ -6,6 +6,8 @@ monthly sharedscripts postrotate - kill -HUP $(cat /var/run/rsyslogd.pid) + if [ -f /var/run/rsyslogd.pid ]; then + kill -HUP $(cat /var/run/rsyslogd.pid) + fi endscript }