Hello,

I did experiment with this.

Turns out, that "User=fetchmail" unsurprisingly is unable to
create a subdirectory in /run. One has to use prefixes for that.
However, I do ignore /etc/default/fetchmail intentionally, so
that needs to be considered. One could use install instead of
mkdir+chown as well.

Cheers,
ew.

# --------------------------
[Unit]
Description=Fetchmail Daemon
Documentation=man:fetchmail(1)
After=network-online.target postfix.service
Wants=network-online.target
ConditionPathExists=/run

[Service]


# /etc/default/fetchmail is intentionally ignored!
Type=simple
Restart=always
User=fetchmail
# use '+' to run the Pre commands with elevated privileges, NOT User=fetchmail!
ExecStartPre=+/bin/mkdir -m 750 -p /run/fetchmail
ExecStartPre=+/bin/chown fetchmail:nogroup /run/fetchmail
ExecStart=/usr/bin/fetchmail --daemon 300 --nodetach --nosyslog --fetchmailrc 
/etc/fetchmail/fetchmailrc --pidfile /run/fetchmail/fetchmail.pid

[Install]
WantedBy=multi-user.target
# --------------------------

-- 
The purpose of computing is insight --- not numbers!
Richard Hamming, 1962

Reply via email to