From: Peter P. <ro...@ri...> - 2020-09-21 09:56:19
|
On Mon, Sep 21, 2020 at 06:57:52PM +1000, Chris James wrote: > Hi Peter, > > Apologies if it went directly to you ... I just “replied” via iPhone mail. Further comment below ... OK, bringing the list back in CC. Further replies inline (top-posting considered harmful anyway :) > > On 21 Sep 2020, at 17:37, Peter Pentchev <ro...@ri...> wrote: > > > > On Mon, Sep 21, 2020 at 05:00:28PM +1000, Chris James wrote: > >> > >>>> On 21 Sep 2020, at 16:01, Peter Pentchev <ro...@ri...> wrote: > >>> > >>> On Mon, Sep 21, 2020 at 11:56:43AM +1000, Chris James wrote: > >>>> Hi, > >>>> > >>>> I’ve been having issues (potential bug) with the polling interval using fetchmail-6.4.8 > >>>> > >>>> I’m running FreeBSD 11.3 inside an iocage jail. The package was pulled from the ‘quarterly’ repository, and is the latest currently available from that source. I’ve checked the bug tracker and see nothing related, nor any fix in releases 6-4-9 >> 6-4-12. > >>>> > >>>> My mail stack is comprised of: > >>>> > >>>> - fetchmail > >>>> - postfix > >>>> - rspamd > >>>> - dovecot > >>>> > >>>> The full stack has been operating for months with no issues. > >>>> > >>>> Fetchmail is running in daemon mode, with the config file located at: > >>>> > >>>> /usr/local/etc/fetchmailrc > >>>> > >>>> … and (redacted) contains: > >>>> > >>>> set daemon 180 > >>> [snip] > >>>> > >>>> This adds a time stamp to the log file for every fetch. There are other mailboxes that pull from the same server using essentially the same config (sans the ‘preconnect’ assertion). > >>>> > >>>>>>> BEHAVIOUR >>> Changing the value of “set daemon” in /usr/local/etc/fetchmailrc has no effect - fetchmail continues to poll every 900 seconds, irrespective of the value set here. I have made repeated changes to the interval (300 seconds, 180 seconds, 120 seconds, 60 seconds) with service fetchmail restart issued after each change, but the polling interval remains at 900 seconds. > >>>> > >>>> However, editing the file: /usr/local/etc/rc.d/fetchmail > >>>> … and changing > >>>> > >>>> : ${fetchmail_config="/usr/local/etc/fetchmailrc"} > >>>> ${fetchmail_polling_interval=“900"} > >>>> > >>>> … to > >>>> > >>>> : ${fetchmail_config="/usr/local/etc/fetchmailrc"} > >>>> : ${fetchmail_polling_interval="300"} > >>>> > >>>> … causes the polling interval to change to 300 seconds, irrespective of the value specified in the /usr/local/etc/fetchmailrc settings file. Thus, it appears that when the daemon starts, it correctly loads the configuration from the fetchmailrc file (since it pulls emails according to the config) but subsequently overrides the polling interval with the setting in /rc.d/fetchmail. > >>> > >>> The fetchmail manual page states that command-line options override > >>> configuration file defaults. The startup script for the fetchmail > >>> service must pass -d to make sure that fetchmail starts in daemon mode, > >>> and since -d requires an argument, the startup script must pass one - > >>> and it uses the value from its own config file. Thus, whatever you put > >>> in the fetchmail config file will be silently ignored > >>> G'luck, > >>> Peter > >> > >> Hi Peter, > >> > >> The FreeBSD manual implies otherwise. Given that fetchmail is started at boot without command line options (fetchmail_enable=“YES” in /etc/rc.conf), it should refer to the daemon poll setting in the fetchmailrc file ... yet that seems to be overridden by a hard-coded default elsewhere. > >> > >> https://www.freebsd.org/cgi/man.cgi?fetchmail > >> Starting the daemon mode > >> There are several ways to make fetchmail work in daemon mode. ... > >> It is also possible to set a polling interval in your fetchmailrc file by saying 'set daemon <interval>', where <interval> is an integer number of seconds. If you do this, fetchmail will always start in daemon mode unless you override it with the command-line option --daemon 0 or -d0. > > > > Hi, > > > > You are quoting the manual page for the fetchmail program, not the > > fetchmail service. The same manual page ought to also have a sentence > > saying something like: > > > > Command-line options override ~/.fetchmailrc declarations. > > > Understood. But without command line declarations, it should pull from the fetchmailrc config, yes? That's what I refered to in my first e-mail. Apparently, the current version of the service file from the FreeBSD port of fetchmail does not depend on there being a "daemon" option in the fetchmail configuration file and says "we need to make sure that fetchmail runs in daemon mode, so we need to pass it a -d option ourselves, we cannot depend on the sysadmin having put that option in the fetchmail configuration file; but, well, the -d option requires an argument, so we must specify the polling interval ourselves now, so we take it from a fetchmail_polling_interval setting in /etc/rc.conf and, if one has not been specified there, we default to 900". The fetchmail service (that comes from the FreeBSD port) passes the -d option to the fetchmail program when starting it. > > What I am saying is that the FreeBSD port of fetchmail installs the > > fetchmail program and the fetchmail manual page, but it also installs a > > FreeBSD-specific rc service that starts fetchmail at boot time if so > > configured. This service is started by the file that you edit: > > /usr/local/etc/rc.d/fetchmail - it is a shell script that reads its own > > configuration file (or the global configuration settings in > > /etc/rc.conf) and then, if enabled, starts fetchmail in daemon mode > > using the options from the service configuration file, not the fetchmail > > one. > > So the line that you changed, the one containing 900 that you changed to > > 300 - it actually checks whether a "fetchmail_polling_interval" variable > > has been defined somewhere. I think that if you define > > fetchmail_polling_interval in /etc/rc.conf, the service will pick it up > > and use it instead of its default of 900, so I think that - specifically > > for the FreeBSD port of fetchmail - you should set the polling interval > > in /etc/rc.conf and not in the fetchmail configuration file. > > > I’m still ... puzzled, I guess - since /usr/local/etc/rc.d/fetchmail is essentially not “user-editable” - by which I mean that next time there’s a pkg upgrade any change will be overwritten - logically any user specified options should be in the fetchmailrc file ... and they are with respect to every other config except - from what you’re saying - the polling interval that would require a separate environment variable added to rc.conf? The FreeBSD service files are configured via /etc/rc.conf. Any options that need to control the service behavior *before* it starts the program that it needs to start, or that control any arguments that the service needs to pass to the program, should be placed in /etc/rc.conf (or, well, in a service-specific configuration file; see https://www.freebsd.org/doc/en_US.ISO8859-1/books/handbook/configtuning-rcd.html and also https://www.freebsd.org/cgi/man.cgi?query=rc.conf&sektion=5&manpath=freebsd-release-ports for more information). So since the FreeBSD service now wants to pass the -d option, it needs to provide an argument to that - and that argument should be taken from the service configuration. > I will add that in previous versions of fetchmail (likely from a year or two ago) I’ve been able to exactly what I’d expect - adjust fetchmailrc with “set daemon XXX” and achieve the polling interval I desire. Hmm, that's quite strange, since the fetchmail_polling_interval handling seems to have been part of the service script in the FreeBSD for at least the past ten years... Unfortunately, I myself have not used FreeBSD for more than ten years now, so all the information that I am giving to you now is from looking at the port's source files at the FreeBSD SVNWeb site; I have not had actual practical experience with the FreeBSD port of fetchmail for, well, more than ten years now. It seems that Matthias Andree himself helps maintain the FreeBSD port; maybe he should be able to clarify this part. > > Hope that helps, and sorry if my first message was a bit brief. > > > > BTW is there a reason why you only replied to me personally and not to > > the whole list? (if it was by accident, and if you decide to send > > a follow-up message to the list, you may quote this message as you wish) (you replied to this part in the top-posted sentence above) G'luck, Peter -- Peter Pentchev ro...@ri... ro...@de... pp...@st... PGP key: http://people.FreeBSD.org/~roam/roam.key.asc Key fingerprint 2EE7 A7A5 17FC 124C F115 C354 651E EFB0 2527 DF13 |