Files
selfpost/build/logrotate-mail.conf
T
mixandClaude Opus 5.5 80faf1a901
test / test (push) Canceled after 0s
logrotate: no reload of a Postfix that is not running yet
The rollout of 0cceb54 to the test server (2026-10-16 04:44 UTC) logged
"postfix/postlog: fatal: the Postfix mail system is not running" and
"error running non-shared postrotate script": the day's rotation was due,
logrotate-loop.sh runs at once when the container starts, and the wrapper
starts Postfix only once the milter sockets are there. Nothing was lost -
no postlogd held the old file, and the one Postfix started a second later
opened the new - but logrotate reported a failure and the loop waited six
hours. The postrotate now runs "postfix reload" only when "postfix status"
says a master runs (Postfix 3.10.13, conf/postfix-script:297-307).

e2e TestStartsOnA27Data also starts on a mail.log whose rotation is due
(a state file of two days before) and wants it rotated with no postrotate
error in the container's log.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-16 07:57:09 +03:00

30 lines
1.3 KiB
Plaintext

# The delivery log lives under the persistent /data, not the ephemeral
# /var/log, so the lines that resolve a "queued" send-log row outlive the
# container (architecture.md § Log tailer). Path and ownership match
# build/postfix-config.sh (maillog_file) and build/entrypoint.sh: postlogd
# writes it as user postfix, the unprivileged panel reads it through the shared
# selfpost group, hence create 0640 postfix selfpost rather than 0644 root root.
# (logrotate 3.22.0, logrotate.8:402: "create mode owner group" makes the new log
# right after the rotation; "delaycompress" leaves the previous log, .1,
# uncompressed until the next cycle.)
/data/log/mail.log {
daily
rotate 14
missingok
notifempty
compress
delaycompress
create 0640 postfix selfpost
# A rotation due when the container starts runs before Postfix does
# (logrotate-loop.sh runs at once, the wrapper waits for the milter
# sockets): no postlogd holds the old file then, the one Postfix starts
# opens the new, and a reload would only fail - "fatal: the Postfix mail
# system is not running", seen at the test server's rollout of
# 2026-10-16. "postfix status" exits 1 while no master runs (Postfix
# 3.10.13, conf/postfix-script:297-307), reload then nothing.
postrotate
/usr/sbin/postfix status >/dev/null 2>&1 || exit 0
/usr/sbin/postfix reload
endscript
}