<div dir="ltr"><br><div><br></div><div class="gmail_extra"><br><br><div class="gmail_quote">On Tue, Nov 26, 2013 at 8:02 AM,  <span dir="ltr">&lt;<a href="mailto:mythtv@phipps-hutton.freeserve.co.uk" target="_blank">mythtv@phipps-hutton.freeserve.co.uk</a>&gt;</span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><br>
Quoting James Linder &lt;<a href="mailto:jam@tigger.ws" target="_blank">jam@tigger.ws</a>&gt;:<br>
<br>
<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">
Indeed it does work, but since it is almost exactly what I already had more spelunking was called for:<br>
<br>
Despite everything systemd DOES NOT wait for the devices to be ready !!<br>
<br>
The real magic occurs here<br>
Restart=on-failure<br>
<br>
and indeed I have two log files ... The first at boot time saying failure ... the second a short time later say all-is-well<br>
<br>
</blockquote>
<br>
I doubt systemd is capable of waiting for a device to be ready, that would require it to know how to operate every possible device and have the knowledge to work out what constitutes ready. So it is probably waiting for the device file to exist. The device file is created by udev so the problem may lie there. I don&#39;t know how udev operates but it may be creating the device at the same time as it loads the kernel module.<br>

<br>
Looking through /var/log/dmesg on my system I see the em28xx module print it&#39;s first message at 5.339s and the last message for tuner 0 at 6.703s. I have three tuners and the last message for the last tuner is at 7.199s. There are enough gaps in that sequence for mythbackend to start and fail.<br>

<br>
I think your best bet is to live with the failure/restart. Anything else is going to add more complexity. Or you could just add a sleep to the mythbackend startup.<br>
<br>
Cheers,<br>
Tim.<br>
<br>
<br>
______________________________<u></u>_________________<br>
mythtv-users mailing list<br>
<a href="mailto:mythtv-users@mythtv.org" target="_blank">mythtv-users@mythtv.org</a><br>
<a href="http://www.mythtv.org/mailman/listinfo/mythtv-users" target="_blank">http://www.mythtv.org/mailman/<u></u>listinfo/mythtv-users</a></blockquote><div><br></div><div><br></div>I use systemd with mythtv. I have mythtv wait for my capture card because otherwise mythtv starts to early and it doesn&#39;t show up. <div>
<br></div><div>I have a udev rule. </div><div><div>#</div><div>## Create systemd device units for capture devices</div><div>##</div><div>SUBSYSTEM==&quot;video4linux&quot;, TAG+=&quot;systemd&quot;</div><div>SUBSYSTEM==&quot;dvb&quot;, TAG+=&quot;systemd&quot;</div>
<div>SUBSYSTEM==&quot;firewire&quot;, TAG+=&quot;systemd&quot;</div></div><div><br></div><div>This allows me to wait for my device in mythbackend systemd service file. </div><div><br></div><div><div>[Unit]</div><div>Description=MythTV Backend</div>
<div>After=network.target mysqld.service</div><div>After=dev-dvb-adapter0-frontend0.device</div><div># Uncomment the following line if you will be using the mythweb plugin on the </div><div># same system as mythbackend.</div>
<div>#Wants=apache2.service </div><div># wait for slow capture card</div><div>Wants=dev-dvb-adapter0-frontend0.device </div><div>[Service]</div><div>Type=simple</div><div>#Environment=HOME=/var/lib/mythtv</div><div>User=mythtv</div>
<div>ExecStart=/usr/bin/mythbackend --logpath /var/log/mythtv</div><div><br></div><div><br></div><div>[Install]</div></div><div>WantedBy=multi-user.target </div></div><br></div></div>