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

George Galt george.galt at gmail.com
Mon May 14 14:40:43 UTC 2012


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.

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.

Thanks,

George



###################################################
# file located at /lib/systemd/system/mythbackend.service
# use "systemctl enable mythtbackend.service to load
# based on a template from RPMFusion and R.G. Newbury from this thread:
# http://www.gossamer-threads.com/lists/mythtv/users/516650?search_string=mythbackend.service%20;#516650

[Unit]
Description=MythTV backend service

After=network.target mysqld.service
# for mythweb: not necessary so 'wants' not 'after'
Wants=httpd.service

[Service]
Type=forking
# Both the RPMFusion version and the verion on
http://www.mythtv.org/wiki/Systemd_mythbackend_Configuration
# use "Type=simple", but I find that it does not seem to work and one
gets a bunch of permission errors.
# It is possible that someone who knew the permissioning schemes
better could return to using "Type=simple"

# description: mythbackend.
# processname: mythbackend
# pidfile: /var/log/mythtv/mythbackend.pid
# NOTE: location of pid file is different from the location used
# by the SysVInit service, which used to place the pid file in /var/run
# because we are running as the mythtv user,

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

# NOTE: if you have other switches you want, insert them below.  This
is set to use log files in
# /var/log/mythtv.  Make sure that the location of the HOME/MYTHCONFIG
files, logs and the pid file
# are writeable by the user designated above.
ExecStart=/usr/bin/mythbackend --daemon --logpath /var/log/mythtv
--pidfile /var/log/mythtv/mythbackend.pid

[Install]
WantedBy=multi-user.target


More information about the mythtv-users mailing list