Got this today:
/etc/cron.daily/logrotate:
logrotate_script: 6: logrotate_script: Syntax error: "fi" unexpected
error: error running non-shared postrotate script for /var/log/mail/freshclam.log of '/var/log/mail/freshclam.log '
run-parts: /etc/cron.daily/logrotate exited with return code 1
What is the content of your /etc/cron.daily/logrotate?
Is there any error when running manually /usr/sbin/logrotate /etc/logrotate.conf?
#!/bin/sh
# skip in favour of systemd timer
if [ -d /run/systemd/system ]; then
exit 0
fi
# this cronjob persists removals (but not purges)
if [ ! -x /usr/sbin/logrotate ]; then
exit 0
fi
/usr/sbin/logrotate /etc/logrotate.conf
EXITVALUE=$?
if [ $EXITVALUE != 0 ]; then
/usr/bin/logger -t logrotate "ALERT exited abnormally with [$EXITVALUE]"
fi
exit $EXITVALUE
root@mx0:/# /usr/sbin/logrotate /etc/logrotate.conf
root@mx0:/#
Seems all good here. Normally it is working fine. Just last night it seemed to fail.
I think my fix was less than stellar, but the error only occurs when the freshclam logs have been rotated. I commented out the postrotate action, but only a comment inside an if statement is apparently not correct. This can be ignored (the file has already been rotated) but it should of course be fixed.
happened again today

I think the issue is in /etc/logrotate.d/clamav-freshclam
/var/log/mail/freshclam.log {
rotate 12
weekly
compress
delaycompress
missingok
create 640 clamav adm
postrotate
if [ -d /run/systemd/system ]; then
systemctl -q is-active clamav-freshclam && systemctl kill --signal=SIGHUP clamav-freshclam || true
else
#invoke-rc.d clamav-freshclam reload-log > /dev/null || true
fi
endscript
}
If I compare with clamav-daemon, if suppose the commented line would be replaced by:
/usr/bin/supervisorctl signal hup clamav-freshclam >/dev/null || true
AFAIK freshclam is not run as daemon. Supervisorctl will fail silently. Not sure if it is a problem...
Alright. Is the directory /run/systemd/system supposed to be there?
We should eliminate the whole else block. It doesn't do anything, right?
Freshclam runs from cron, not as a daemon. The whole postrotate block (from postrotate to endscript?) should be removed, it is not needed.
@gmasse You were faster than me! Thanks for fixing! :)
Hello,
i have the same problem. Since 3 weeks I get a cron error mail with subject
          "Cron
run-parts --report /etc/cron.daily )"
and content says
/etc/cron.daily/logrotate:
logrotate_script: 6: logrotate_script: Syntax error: "fi" unexpected
error: error running non-shared postrotate script for /var/log/mail/freshclam.log of '/var/log/mail/freshclam.log '
run-parts: /etc/cron.daily/logrotate exited with return code 1
Problem is this commented line. Today I've run the update with lastet
but its still commented.
Regards
     Helmut
Am 17.05.20 um 18:18 schrieb Germain Masse:
>
I think the issue is in |/etc/logrotate.d/clamav-freshclam|
|/var/log/mail/freshclam.log { rotate 12 weekly compress delaycompress
missingok create 640 clamav adm postrotate if [ -d /run/systemd/system
]; then systemctl -q is-active clamav-freshclam && systemctl kill
--signal=SIGHUP clamav-freshclam || true else #invoke-rc.d
clamav-freshclam reload-log > /dev/null || true fi endscript } |If I compare with |clamav-daemon|, if suppose the commented line would
be replaced by:|/usr/bin/supervisorctl signal hup clamav-freshclam >/dev/null || true |
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
https://github.com/tomav/docker-mailserver/issues/1507#issuecomment-629822912,
or unsubscribe
https://github.com/notifications/unsubscribe-auth/AC7UW3BGJ4WF33NOGYSSOQLRSAE5ZANCNFSM4M5IRLVQ.
@helmutundarnold this has been fixed in latest and in 7.0.1. Perhaps you didn't recreate the container (compose down/up) or something? This is the logrotate job I have:
/var/log/mail/freshclam.log {
rotate 12
weekly
compress
delaycompress
missingok
create 640 clamav adm
}
As you can see there is no commented invoke-rc.d left.
Thanks for this quick Answer Erik,
indeed I've just run
 docker-compose -f
After recreating the container its solved.
Thanks for all your Support
Best Regards
     Helmut
Am 29.05.20 um 07:36 schrieb Erik Wramner:
>
@helmutundarnold https://github.com/helmutundarnold this has been
fixed in latest and in 7.0.1. Perhaps you didn't recreate the
container (compose down/up) or something? This is the logrotate job I
have:|/var/log/mail/freshclam.log { rotate 12 weekly compress delaycompress
missingok create 640 clamav adm } |As you can see there is no commented invoke-rc.d left.
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
https://github.com/tomav/docker-mailserver/issues/1507#issuecomment-635769823,
or unsubscribe
https://github.com/notifications/unsubscribe-auth/AC7UW3CELRTN2Q2PV6XN7P3RT5CUPANCNFSM4M5IRLVQ.