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:
Do you have IMAP client running all the time? If yes, this won't really help because:
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.
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".
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