[mythtv-users] starting with systemd was Who's running Myth on Arch, and what do you think?

James Linder jam at tigger.ws
Tue Nov 26 01:30:06 UTC 2013


On 24/11/2013, at 8:00 PM, mythtv-users-request at mythtv.org wrote:

> I'm using openSUSE 12.3, and this is my mythbackend.service file. It's been working flawlessly for some time now. I hope it helps. Make sure you have a HOME variable.
> If you change your file, you have to run as root: # systemctl daemon-reload 
> for udev to re-read the configuration files.
> 
> ###################################################
> # file located at /etc/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?se[..]
> 
> [Unit]
> Description=MythTV backend service
> 
> After=network.target mysql.service
> After=dev-dvb-adapter0-frontend0.device
> # for mythweb: not necessary so we put 'wants' not 'after'
> #Wants=httpd.service
> # On openSUSE, it's 'apache2', not 'httpd' service
> Wants=apache2.service
> # Try to wait until the DVB-T adapter is present.
> # for this to work a udev.rules file has to be created. I'm calling mine 11-mythbackend.rules
> Wants=dev-dvb-adapter0-frontend0.device
> 
> [Service]
> Type=simple
> # For the rare crashes, the service will restart automatically. Cool?
> Restart=on-failure
> 
> # The HOME environment variable is necessary for mythbackend to find it's configuration files.
> Environment=HOME=/home/yianni
> # Making sure that it runs with proper locale settings.
> Environment=LANG=el_GR.UTF-8
> Environment=LC_CTYPE=el_GR.UTF-8
> Environment=LC_NUMERIC=el_GR.UTF-8
> Environment=LC_TIME=el_GR.UTF-8
> Environment=LC_COLLATE=el_GR.UTF-8
> Environment=LC_MONETARY=el_GR.UTF-8
> Environment=LC_MESSAGES=el_GR.UTF-8
> Environment=LC_PAPER=el_GR.UTF-8
> Environment=LC_NAME=el_GR.UTF-8
> Environment=LC_ADDRESS=el_GR.UTF-8
> Environment=LC_TELEPHONE=el_GR.UTF-8
> Environment=LC_MEASUREMENT=el_GR.UTF-8
> Environment=LC_IDENTIFICATION=el_GR.UTF-8
> Environment=LC_ALL=el_GR.UTF-8
> Environment=MYTHBACKEND_OPTIONS=--nodblog --loglevel warning --syslog local7
> # NOTE: using the "yianni" user, NOT root.
> User=yianni
> 
> # 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.
> ExecStartPre=/sbin/modprobe snd_pcm_oss
> #ExecStartPre=/sbin/modprobe smsdvb
> 
> ExecStart=/usr/bin/mythbackend --loglevel warning --syslog local7
> ExecStartPost=/usr/bin/sudo /usr/bin/chown -R yianni:users /var/log/mythtv
> 
> [Install]
> WantedBy=multi-user.target
> ####################################
> 
> File: /etc/udev/rules.d/11-mythbackend.rules
> #
> # Create systemd device units for capture devices
> # Then you have to either reboot or enter as root: # udevadm control --reload
> SUBSYSTEM=="video4linux", TAG+="systemd"
> SUBSYSTEM=="dvb", TAG+="systemd"
> ####################################

Indeed it does work, but since it is almost exactly what I already had more spelunking was called for:

Despite everything systemd DOES NOT wait for the devices to be ready !!

The real magic occurs here
Restart=on-failure

and indeed I have two log files ... The first at boot time saying failure ... the second a short time later say all-is-well

James


More information about the mythtv-users mailing list