gares / syncmaildir

Maildir synchronization tool
GNU General Public License v3.0
18 stars 3 forks source link

show output from hooks, be more --verbose #11

Open anarcat opened 5 years ago

anarcat commented 5 years ago

I have recently seen a total failure happen in my email setup. I do not know exactly what the cause was, and it was hard to diagnose because my systemd setup (#10) didn't log anything to disk.

But even if it would log, I would like to have it a little more verbose. Right now I see this in my logs:

fév 18 13:42:48 curie smd-pull[5482]: default: smd-client@localhost: TAGS: stats::new-mails(1), del-mails(0), bytes-received(31480), xdelta-received(385) 

Even in --verbose --show-tags mode, I don't see the actual emails modified, which is strange because we do see those when running in --dry-mode (see #6 for that). The --verbose flag only adds the following lines:

fév 18 13:46:52 curie smd-push[8294]: Phase 0: handshake 
fév 18 13:46:52 curie smd-push[8294]: Phase 1: changes detection 
fév 18 13:46:52 curie smd-push[8294]: Phase 2: synchronization 
fév 18 13:46:52 curie smd-push[8294]: Phase 3: agreement 

which are fairly useless in a non-interactive context.

Would it be possible to show which mails were downloaded/uploaded/deleted in --verbose mode instead of --dry-run?

Also: I run notmuch new as a post-hook. Because I first notice the catastrophe through notmuch (which was slowly removing all the emails from its database), it would be tremendously helpful it the output from hooks was also shown instead of silencing them. For example here notmuch shows:

Processed 4 total files in almost no time.
Added 3 new messages to the database.

Would you welcome patches that would change at least that behavior?

Thanks!

anarcat commented 5 years ago

forget about the hook stuff, I found a workaround. I added the following systemd service for notmuch-new:

[Unit]
Description=notmuch new
After=smd-pull.service smd-push.service

[Service]
Type=oneshot
Nice=10
ExecStart=notmuch new

[Install]
WantedBy=multi-user.target smd-pull.service smd-push.service

... and enabled it:

systemctl --user daemon-reload
systemctl --user enable notmuch-new.service

Now it gets ran after smd-pull or push and I see it in my logs.

It would still be nice to have more extensive info about file changes however.