fetchmail supports IMAP's "IDLE" command, which practically implements a 'push-mail' system. With the IDLE command, fetchmail can just wait until the IMAP server notifies it of a new email. Upon receiving the notification, fetchmail will 'wake up' and retrieve the email (and deliver it eiher to local mailboxes or to another SMTP server). The benefit of the IDLE command is two-fold: (1) Less bandwidth usage since fetchmail no longer has to poll the server repeatedly, and (2) Prompt email delivery instead of having to wait until the next polling time. The drawback: If one uses the IDLE command, fetchmail practically 'latches' itself to *exactly* one IMAP server; one can no longer specify multiple IMAP/POP3 servers in the /etc/fetchmailrc file. If one needs to pull email from two or more email servers (as in my situation currently), one needs multiple fetchmail daemons all IDLE-ing, each with its own fetchmailrc. Obstacle: The current initscript for fetchmail is hard-wired for exactly one fetchmail daemon. My solution: rewrite the initscript in a way kind of similar to the net.* initscripts, and allow multiple fetchmail daemons to run in memory. The main /etc/init.d/fetchmail script reads /etc/fetchmailrc, and if one needs another fetchmail daemon, one just do `ln -s /etc/init.d/fetchmail /etc/init.d/fetchmail2` then create the relevant /etc/conf.d/fetchmail2 *and* /etc/conf.d/fetchmail2rc files. Since this is an extensive rewrite of the initscript, I'll attach the complete initscript instead. Reproducible: Always
Created attachment 284359 [details] Proposed new initscript for net-mail/fetchmail This is the *complete* and production-ready initscript I've suggested in the description of this bug.
+*fetchmail-6.3.21 (24 Aug 2011) + + 24 Aug 2011; Eray Aslan <eras@gentoo.org> +files/fetchmail.initd, + -files/MD5_library_pickup.patch, +fetchmail-6.3.21.ebuild, + -files/debian-580796.patch, +files/fetchmail.confd: + Version bump. Add socks USE flag - bug #380405. Allow multiple deamons - bug + #380371. Remove unused patches. +