Re: Unit for getmail (was: daemontools)

Charles Cazabon <[email protected]>
Newsgroups gmane.mail.getmail.user
Message-ID <[email protected]>
Daniel Kahn Gillmor <[email protected]> wrote:
> On Thu 2018-02-01 03:12:48 +0100, Volker Wysk wrote:
> > [Unit]
> > Description=Getmail für [email protected]
> > Wants=dovecot.service
> > After=dovecot.service
> >
> > [Service]
> > ExecStart=/usr/bin/getmail --getmaildir=/etc/getmail --rcfile=verteilerrc --idle INBOX
> > Restart=always
> >
> > [Install]
> > WantedBy=multi-user.target
> > systemctl start verteilerrc.service
> 
> this installs the service as a sytsem service, and it looks like it's
> running as the superuser.  
> 
> That seems ill-advised.

There are some use cases for getmail running as root; in particular, when you
have a configuration where getmail is delivering mail to multiple users and it
needs to change to a different delivered-to user for each message that it
retrieves.  But you're right, as a general rule, getmail should be run with
the minimum privileges that it requires for a given configuration.

My other concern with the above is that it looks like it will spin as fast as
it can, with systemd restarting it immediately after it exits.  Perhaps
systemd will even detect it as a failing process if it exits too often too
quickly?  How would one add a delay in between runs with a systemd unit file?

This all makes the `sleep 900; exec getmail` daemontools run script look a
*lot* simpler.

Charles
-- 
-----------------------------------------------------------------------
Charles Cazabon
GPL'ed software available at:               http://pyropus.ca/software/
-----------------------------------------------------------------------
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.