Systemd unit file: Can/Should ExecStart and ExecStop run a script?

Lennart Poettering mzerqung at 0pointer.de
Wed Oct 19 20:29:45 UTC 2011


On Wed, 19.10.11 18:58, "Jóhann B. Guðmundsson" (johannbg at gmail.com) wrote:

> This is what I wrote a while back for mythtv in rpmfusion but never 
> submitted since I could not find someone to test it.
> 
> Note this got picked up by someone and adapted to atrpm version the 
> other day.
> 
> Cant recall if that indvidual pinged me on irc or on some mailing list.
> 
> #cat mythbackend.service
> 
> [Unit]
> Description=MythTV Backend
> After=syslog.target network.target mysqld.service

The After=syslog.target is unnecessary these days and should be removed
to keep things simple.

> 
> [Service]
> Type=forking
> PIDFile=/run/mythbackend.pid
> Environment=MYTHCONFDIR=/etc/mythtv
> Environment=HOME=/etc/mythtv

Is this really necessary? $HOME is something that should be set
according to the user something is run as. And it should be set in the
same code that drops the privileges.

> ExecStart=/usr/bin/mythbackend --daemon --logfile 
> /var/log/mythtv/mythbackend.log --pidfile /run/mythbackend.pid
> StandardError=syslog

We now default to syslog logging, so I can only recommend to drop this
line here, in order not to override the system-wide setting.

Lennart

-- 
Lennart Poettering - Red Hat, Inc.


More information about the devel mailing list