[mythtv-users] Systemd File For MythTV on Fedora Questions

Richard Shaw hobbes1069 at gmail.com
Mon May 14 14:51:13 UTC 2012


On Mon, May 14, 2012 at 9:40 AM, George Galt <george.galt at gmail.com> wrote:
> All:
>
> I've been working on a .service script for the mythbackend on systemd
> for my Fedora 16 x86_64 backend, which is installed using Axel's
> ATrpms repositories.  The script so far is below and owes a lot to the
> discussion last week.  Currently, this file works for me.
>
> I've got a few questions that I'm hoping someone can answer:
>
> 1)  Permissions.  The script below runs the backend as user "mythtv"
> rather than "root".  I've set permissions for the directories
> containing the recordings/videos, coverart (etc), logs, database
> backup, and pid file to user=mythtv, but is there anything else that I
> might be missing or anything that I should look out for?  So far, this
> seems to work, but if there is something that is run infrequently I
> might not have seen it yet.

It has not been necessary to run mythbackend as root for quite some
time. Just make sure the mythtv user is in the audio and video groups
for access to those devices.

It shouldn't be necessary to change permissions on the physical
database since mythtv logs in through the server interface.
Additionally, you don't need to worry about the PID file if you use
Type=simple, see below.


> 2)  service type.  The RPMfusion script and the script on the mythtv
> wiki designate the service as "type=simple".  RG Newbury's version
> (from last week's discussion) used "type=forking".  I find that if I
> try to use "type=simple" the startup fails with "systemd[1]:
> mythbackend.service stopping timed out. Killing." in
> /var/log/messages.  Does anyone know why this might be?  I find the
> description here:
> http://fedoraproject.org/wiki/Packaging:Systemd#.5BService.5D to be
> unhelpful.

If you use "Type=simple" then you need to drop the --daemon options.
Simple is preferred over forking in systemd. Basically systemd picks
up the PID when it starts the backend. If you use --daemon then
mythbackend forks so then you have to use a PID file.


> Environment=MYTHTV_HOME=/var/lib/mythtv
> Environment=MYTHCONFDIR=/var/lib/mythtv
> Environment=HOME=/var/lib/mythtv
> # NOTE: using the "mythtv" user, NOT root.
> User=mythtv
> EnvironmentFile=/etc/sysconfig/mythbackend

Using both the Environment and EnvironmentFile options is redundant.
EnvrionmentFile is more for backwards compatibility, so drop that in
favor of Environment.


> ExecStart=/usr/bin/mythbackend --daemon --logpath /var/log/mythtv
> --pidfile /var/log/mythtv/mythbackend.pid

To use Type=simple, drop the --daemon and --pidfile options.

Richard


More information about the mythtv-users mailing list