From 17c75c88ac91fa010de779b4c53883f1f58f0308 Mon Sep 17 00:00:00 2001 From: "Danilo M." Date: Tue, 4 Aug 2026 12:17:27 +0200 Subject: docs: warn against redirecting mailsync.sh into its own log The obvious crontab line is the wrong one. The script writes to ~/.local/state/mailsync.log itself, so a caller appending to that same file gets every line twice, which is what the first real run of the moved script did. Also records that rotation belongs to logrotate rather than the script, and why: the two fought over the same file and the script overwrote a compressed generation with an uncompressed one. Co-Authored-By: Claude Opus 5 --- README.md | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'README.md') diff --git a/README.md b/README.md index a726a24..bf052b3 100644 --- a/README.md +++ b/README.md @@ -284,6 +284,19 @@ ln -s "$PWD/assets/mailsync.sh" ~/bin/mailsync.sh A symlink rather than a copy, so the same script serves cron and the running application and there is only one of it to edit. +It writes to `~/.local/state/mailsync.log` itself, so a caller must **not** +redirect into that file as well. The obvious crontab line is the wrong one: + +```cron +*/10 * * * * ~/bin/mailsync.sh # right +*/10 * * * * ~/bin/mailsync.sh >> mailsync.log 2>&1 # every line twice +``` + +Rotation is left to `logrotate`, which does it better than a shell script can. +An earlier version rotated by size on its own and fought `/etc/logrotate.d/` +over the same file, overwriting a compressed generation with an uncompressed +one. + Two things any replacement has to get right, both learned the hard way: - **Print to stdout as well as any log file.** qtmaildir shows what the command -- cgit v1.2.3