aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDanilo M. <danix@danix.xyz>2026-08-04 12:17:27 +0200
committerDanilo M. <danix@danix.xyz>2026-08-04 12:55:03 +0200
commit17c75c88ac91fa010de779b4c53883f1f58f0308 (patch)
tree81d8d4147b34b4a443cadbae19c8e718134486c4
parent28653ea5ac7472233425ad8f77837dba5bf4e286 (diff)
downloadqtmaildir-17c75c88ac91fa010de779b4c53883f1f58f0308.tar.gz
qtmaildir-17c75c88ac91fa010de779b4c53883f1f58f0308.zip
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 <noreply@anthropic.com>
-rw-r--r--README.md13
1 files changed, 13 insertions, 0 deletions
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