Systemd mythbackend Configuration
Some newer Linux distributions replace the traditional LSB init script startup management process with a program called systemd, which does things differently; here are some notes on how to make MythTV play nicely with systemd. A cheatsheet from the traditional init scripts to systemd is available on the Fedora wiki pages.
Note that much of the example startup code that follows is based on the rpmfusion packaging of MythTV by Richard Shaw.
Save the configuration file below in
Changes to files in /lib/systemd/system will be over-written when updated.
To enable the backend to start at the next boot, issue the command 'systemctl enable mythbackend.service'. To start the backend immediately, issue the command 'systemctl start mythbackend.service'.
If you specify a log file, all logging will be to that file. If you specify a logpath each program will write to distinctly named files: much better for debugging. Loglevel determines what is logged. Log messages at lower levels will be discarded: In descending order: emerg, alert, crit, err, warning, notice, info, debug. Defaults to info.
Delay starting the backend until tuners have initialized
Some tuners take a long time to initialize (typically, firmware loading) and may therefore not yet be available when the backend starts. Since the backend checks for the presence of tuners upon startup, tuner initialization needs to be completed before the backend is started.
This can be accomplished by adding additional Wants= and After= stanza to the unit file, but to have systemd create device units, you must first add a rule to the udev rules directory.
With the udev rule tag, systemd will create a device unit at startup that one can add to the [Unit] stanza in the startup. Note that one must use the systemd mangled names (generally /dev/some/thing is mangled into dev-some-thing.device). It is highly recommended that you use udev persistent names rather than base names such as /dev/video0.
Systemd has a built-in timeout on device units so that startup will not wait forever for a failed device startup.