[Dovecot] fetchmail on demand

Timo Sirainen tss at iki.fi
Sat May 31 22:06:15 EEST 2008


On Sat, 2008-05-31 at 17:46 +0100, Graeme Vetterlein wrote:

> Now what would be much nicer, would simply be to have dovecot(1)  issue 
> the fetchmail(1) command whenever it it got an imap request.

I've thought about this before too, but haven't bothered to implement
such plugin. Wouldn't be too difficult. But:

1. Do you have IMAP client running all the time? If yes, this won't
really help because:

2. Many IMAP clients simply issue an IDLE command and wait for new data
to become available from server. So the server has to decide when to
poll for new mail anyway.

3. All commands should check for new mail. But of course you wouldn't
want fetchmail to be executed multiples times per second. So there
should be some limit like max "once a minute".

4. If there are multiple connections (and many clients do that), Dovecot
creates multiple processes. Only one process should be calling
fetchmail.

So I think the best solution would be to use post-login scripting:
http://wiki.dovecot.org/PostLoginScripting

Create a script something like:

#!/bin/sh

if ! ps|grep fetchmail-runner.sh; then
  # start calling fetchmail every n minutes
  fetchmail-runner.sh &
fi
/usr/local/libexec/dovecot/imap
if ! ps|grep imap$; then
  # this was the last imap process.
  killall fetchmail-runner.sh
fi

-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: This is a digitally signed message part
Url : http://dovecot.org/pipermail/dovecot/attachments/20080531/c73b8452/attachment.bin 


More information about the dovecot mailing list