DevHeads.net

logrotate failed ... (CentOS 6.9)

I get regularily such a mail

<mail>
Anacron job 'cron.daily' on ....

/etc/cron.daily/logrotate:

error: error running non-shared postrotate script for
/var/log/clamd.clamsmtp/clamsmtpd.log of
'/var/log/clamd.clamsmtp/clamsmtpd.log '
</mail>

content of /etc/logrotate.d/clamsmtp

/var/log/clamd.clamsmtp/clamsmtpd.log {
monthly
notifempty
missingok

postrotate
pkill -SIGHUP -f clamd.clamsmtp >/dev/null 2>&1 || :
endscript
}

when looking at ls:

<ls -al /var/log/clamd.clamsmtp/>
total 572
drwxr-xr-x. 2 clamsmtp mail 4096 May 1 03:15 .
drwxr-xr-x. 6 root root 4096 May 1 03:15 ..
-rw-r-----. 1 clamsmtp mail 953 May 1 08:43 clamsmtpd.log
-rw-r-----. 1 clamsmtp mail 109806 Jan 1 10:28 clamsmtpd.log-20170101
-rw-r-----. 1 clamsmtp mail 114825 Feb 1 03:42 clamsmtpd.log-20170201
-rw-r-----. 1 clamsmtp mail 101356 Mar 1 03:50 clamsmtpd.log-20170301
-rw-r-----. 1 clamsmtp mail 112365 Apr 1 19:51 clamsmtpd.log-20170401
-rw-r-----. 1 clamsmtp mail 104204 May 1 03:15 clamsmtpd.log-20170501
</ls>

this shows normal

where does this error mail come from?

Thanks
Walter

Comments

Re: logrotate failed ... (CentOS 6.9)

By James Pearson at 05/01/2017 - 06:15

The following may help:

<a href="https://bugzilla.redhat.com/show_bug.cgi?id=1376815" title="https://bugzilla.redhat.com/show_bug.cgi?id=1376815">https://bugzilla.redhat.com/show_bug.cgi?id=1376815</a>

James Pearson

Re: logrotate failed ... (CentOS 6.9)

By Walter H. at 05/01/2017 - 22:22

On 01.05.2017 13:15, James Pearson wrote:
I found your hint several time ago, this didn't solve it ...

I don't understand this

- killall -HUP clamd.<SERVICE> 2>/dev/null || :
+ killall -HUP clamd.<SERVICE> > /dev/null 2>&1 || true

in the patch

as the file has this
pkill -SIGHUP -f clamd.clamsmtp >/dev/null 2>&1 || :

in comparison /etc/logrotate.d/clamav has this

killall -HUP clamd >/dev/null 2>&1 || :

Re: logrotate failed ... (CentOS 6.9)

By James Pearson at 05/03/2017 - 03:03

Walter H. wrote:
Sorry, I have no other suggestions - logrotate will only 'error' in that
way if the postrotate commands return something other than zero - and in
the examples you've given, it will always return 0 ...

James Pearson