notmuch-poll and OfflineIMAP

classic Classic list List threaded Threaded
5 messages Options
Jacek Generowicz Jacek Generowicz
Reply | Threaded
Open this post in threaded view
|

notmuch-poll and OfflineIMAP

Hello,

Would you have any advice on how to construct a notmuch-poll script
that would work well in concert with OfflineIMAP?  In particlular, how
can you avoid having to re-issue the IMAP account passwords?

The OfflineIMAP docs state that SIGUSR1 forces an immediate resync of
all accounts, so something based around

    kill -SIGUSR1 `cat ~/.offlineimap/pid`

or

    pkill -SIGUSR1 -u `whoami` offlineimap

(with an already-running OfflineIMAP process in autorefresh mode)
could work, but it's not clear to me how to discover when the resync
is done, and sleeping for an arbitrary time before calling 'notmuch
new' seems unsatisfactory.

Any words of wisdom?

Thanks.
_______________________________________________
notmuch mailing list
[hidden email]
http://notmuchmail.org/mailman/listinfo/notmuch
Jani Nikula Jani Nikula
Reply | Threaded
Open this post in threaded view
|

Re: notmuch-poll and OfflineIMAP

Jacek Generowicz <[hidden email]> writes:

> Hello,
>
> Would you have any advice on how to construct a notmuch-poll script
> that would work well in concert with OfflineIMAP?  In particlular, how
> can you avoid having to re-issue the IMAP account passwords?
>
> The OfflineIMAP docs state that SIGUSR1 forces an immediate resync of
> all accounts, so something based around
>
>     kill -SIGUSR1 `cat ~/.offlineimap/pid`
>
> or
>
>     pkill -SIGUSR1 -u `whoami` offlineimap
>
> (with an already-running OfflineIMAP process in autorefresh mode)
> could work, but it's not clear to me how to discover when the resync
> is done, and sleeping for an arbitrary time before calling 'notmuch
> new' seems unsatisfactory.
>
> Any words of wisdom?

Offlineimap supports running hooks after syncing. Check if SIGUSR1 does
that too. Then you could run notmuch new in the post sync hook.

Also, notmuch new supports pre-new and post-new hooks. You could start
or SIGUSR1 offlineimap in the pre-new hook. See man notmuch-hooks for
details.


HTH,
Jani.
_______________________________________________
notmuch mailing list
[hidden email]
http://notmuchmail.org/mailman/listinfo/notmuch
Adam Wolfe Gordon Adam Wolfe Gordon
Reply | Threaded
Open this post in threaded view
|

Re: notmuch-poll and OfflineIMAP

In reply to this post by Jacek Generowicz
Hi Jacek,

On Tue, Apr 3, 2012 at 09:27, Jacek Generowicz <[hidden email]> wrote:

> Would you have any advice on how to construct a notmuch-poll script
> that would work well in concert with OfflineIMAP?  In particlular, how
> can you avoid having to re-issue the IMAP account passwords?
>
> The OfflineIMAP docs state that SIGUSR1 forces an immediate resync of
> all accounts, so something based around
>
>    kill -SIGUSR1 `cat ~/.offlineimap/pid`
>
> or
>
>    pkill -SIGUSR1 -u `whoami` offlineimap
>
> (with an already-running OfflineIMAP process in autorefresh mode)
> could work, but it's not clear to me how to discover when the resync
> is done, and sleeping for an arbitrary time before calling 'notmuch
> new' seems unsatisfactory.
>
> Any words of wisdom?

I run offlineimap in autorefresh mode (with IDLE too, actually) and
use a script based on inotify to update notmuch whenever new mail
comes in: https://gist.github.com/1952483 . It sounds like some
variant of this would probably work for you.

As an added bonus, I have my post-new script run emacsclient -n -e
'(notmuch-hello-update t)', so if I flip to my mail desktop I can see
right away if there's new mail.
_______________________________________________
notmuch mailing list
[hidden email]
http://notmuchmail.org/mailman/listinfo/notmuch
--
Adam Wolfe Gordon
spaetz spaetz
Reply | Threaded
Open this post in threaded view
|

Re: notmuch-poll and OfflineIMAP

In reply to this post by Jani Nikula
Jani Nikula <[hidden email]> wrote:

>Jacek Generowicz <[hidden email]> writes:
>
>> Hello,
>>
>> Would you have any advice on how to construct a notmuch-poll script
>> that would work well in concert with OfflineIMAP?  In particlular,
>how
>> can you avoid having to re-issue the IMAP account passwords?

>> Any words of wisdom?
>
>Offlineimap supports running hooks after syncing. Check if SIGUSR1 does
>that too. Then you could run notmuch new in the post sync hook.
>
>Also, notmuch new supports pre-new and post-new hooks. You could start
>or SIGUSR1 offlineimap in the pre-new hook. See man notmuch-hooks for

Offlineimap hooks work nicely for running notmuch scripts, i run it this way. Sending Sigusr1 will invoke that too, but I don't think that would be needed. It's mostly for peole running OfflineMap as a daemon....

--
Sent from my Android phone with K-9 Mail. Please excuse my brevity.
_______________________________________________
notmuch mailing list
[hidden email]
http://notmuchmail.org/mailman/listinfo/notmuch
spaetz spaetz
Reply | Threaded
Open this post in threaded view
|

Re: notmuch-poll and OfflineIMAP

In reply to this post by Adam Wolfe Gordon
Adam Wolfe Gordon <[hidden email]> wrote:
>
>I run offlineimap in autorefresh mode (with IDLE too, actually) and
>use a script based on inotify to update notmuch whenever new mail
>comes in: https://gist.github.com/1952483 . It sounds like some
>variant of this would probably work for you.

I actually plan to add new-message-hooks to offlineimap fairly soon.

Sebastian

--
Sent from my Android phone with K-9 Mail. Please excuse my brevity.
_______________________________________________
notmuch mailing list
[hidden email]
http://notmuchmail.org/mailman/listinfo/notmuch