fetchmail ignores settings in /etc/sysconfig/fetchmail

With openSUSE 13.1 fetchmail read the variables defined in /etc/sysconfig/fetchmail:

FETCHMAIL_POLLING_INTERVAL="60"
FETCHMAIL_FETCHALL="yes"
FETCHMAIL_SILENT="no"
FETCHMAIL_USER="fetchmail"
FETCHMAIL_EXPERT_OPTIONS=""
FETCHMAIL_RC_PATH="/etc/fetchmailrc"

With version 13.2 these values are no longer used. Any idea?

Fetchmail used to have a SysV script in /etc/init.d/ which was modified to read /etc/sysconfig/fetchmail, now it’s a systemd service file which does not - it only reads /etc/fetchmailrc

If you want to add parameters, you could either do it in the rc or modify the systemd file ( /usr/lib/systemd/system/fetchmail.service ) but that might get overwritten by an update.

As a quick fix I modified the latter. Being unsure about the first option I had a look at /etc/init.d/postfix and would have some minimal solution for fetchmail. Would sourcing /etc/sysconfig/fetchmail, invoking fetchmail in file /etc/init.d/fetchmail and adding a link in /etc/init.d/rc3.d/ work? Which command will take precedence, /usr/lib/systemd/system/fetchmail.service or /etc/init.d/fetchmail?

SysV scripts are going the way of the dodo in the future so it’s a safe bet to use a systemd file.

You could prevent the systemd file from being overwritten with chattr +i ( http://en.wikipedia.org/wiki/Chattr, +i being immutable ie. cannot be overwritten ) in case you want to make changes to it. Remember to systemctl daemon-reload so the changes to the systemd service file will take effect.

Set immutable attribute and got an error when refreshing fetchmail-6.3.26-6.1.4.x86_64. The file is now safe from being overwritten without being noticed.

When upgrading to openSUSE Leap 42.1 again some of the services needed a change to work as desired. Some decent description how to do this in a more canonical way is given here: https://access.redhat.com/documentation/en-US/Red_Hat_Enterprise_Linux/7/html/System_Administrators_Guide/sect-Managing_Services_with_systemd-Unit_Files.html#brid-Managing_Services_with_systemd-Extending_Unit_Config Changes applied are displayed:

erlangen:~ # systemd-delta|head -33
**[OVERRIDDEN]** /etc/systemd/system/minidlna.service → /usr/lib/systemd/system/minidlna.service

--- /usr/lib/systemd/system/minidlna.service    2016-03-23 22:36:05.000000000 +0100
+++ /etc/systemd/system/minidlna.service        2016-04-14 06:45:17.165277325 +0200
@@ -7,7 +7,7 @@
 PIDFile=/var/run/minidlnad.pid
 ExecStartPre=/usr/sbin/minidlnaconfig
 EnvironmentFile=-/var/lib/minidlna/rescan.conf
-ExecStart=/usr/sbin/minidlnad $RESCAN -P /var/run/minidlnad.pid -f /var/lib/minidlna/minidlna.conf
+ExecStart=/usr/sbin/minidlnad $RESCAN -P /var/run/minidlnad.pid
 
 [Install]
 WantedBy=multi-user.target

[EQUIVALENT] /etc/systemd/system/default.target → /usr/lib/systemd/system/default.target
**[OVERRIDDEN]** /etc/systemd/system/fetchmail.service → /usr/lib/systemd/system/fetchmail.service

--- /usr/lib/systemd/system/fetchmail.service   2015-09-11 12:16:48.000000000 +0200
+++ /etc/systemd/system/fetchmail.service       2016-04-14 06:51:23.571706205 +0200
@@ -4,7 +4,7 @@
 
 [Service]
 User=fetchmail
-ExecStart=/usr/bin/fetchmail -d 900 -f /etc/fetchmailrc
+ExecStart=/usr/bin/fetchmail -a -d 60 -f /etc/fetchmailrc
 RestartSec=1
 
 [Install]

[EXTENDED]   /run/systemd/system/session-250.scope → /run/systemd/system/session-250.scope.d/90-SendSIGHUP.conf
[EXTENDED]   /run/systemd/system/session-250.scope → /run/systemd/system/session-250.scope.d/90-KillMode.conf
[EXTENDED]   /run/systemd/system/session-250.scope → /run/systemd/system/session-250.scope.d/90-After-systemd-user-sessions\x2eservice.conf
[EXTENDED]   /run/systemd/system/session-250.scope → /run/systemd/system/session-250.scope.d/90-After-systemd-logind\x2eservice.conf
erlangen:~ #