diff options
| author | Danilo M. <danix@danix.xyz> | 2026-08-04 12:17:27 +0200 |
|---|---|---|
| committer | Danilo M. <danix@danix.xyz> | 2026-08-04 12:55:03 +0200 |
| commit | 17c75c88ac91fa010de779b4c53883f1f58f0308 (patch) | |
| tree | 81d8d4147b34b4a443cadbae19c8e718134486c4 | |
| parent | 28653ea5ac7472233425ad8f77837dba5bf4e286 (diff) | |
| download | qtmaildir-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.md | 13 |
1 files changed, 13 insertions, 0 deletions
@@ -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 |
