[mythtv-users] delaying mythbackend startup until a STB is available

Ian Cameron mkbloke at gmail.com
Tue Feb 5 11:21:09 UTC 2019


On Tue, 5 Feb 2019 16:29 Stephen Worthington <stephen_agent at jsw.gen.nz
wrote:

> On Tue, 5 Feb 2019 15:47:20 +0530, you wrote:
>
> >On Tue, 5 Feb 2019 15:08 Stephen Worthington <stephen_agent at jsw.gen.nz
> >wrote:
> >
> >> I do not know of any way for Linux to know that it has had a power
> >> failure or similar bad shutdown.
> >>
> >
> >You could script it, maybe touch a file on successful shutdown in non
> >volatile storage, perhaps by modifying the backend unit file. On startup,
> >if file exists, shutdown was clean, delete the file and carry on. If the
> >file does not exist, sleep for x time and then carry on.
> >
> >Cheers, Ian
>
> Except that you can not touch files after the filesystem has been shut
> down.  And if you touch a file before the shutdown, you can still get
> a bad shutdown that happens after that point.  In this particular
> case, you can also get the case where the power goes off while the
> MythTV box is down for maintenance (eg kernel upgrade).  But setting a
> flag like that does reduce the window of time when things can happen
> without the system knowing about it.
>

For sure, it's not the perfect solution, although it would work enough of
the time IMHO. The edge-case you mention is valid, but probably not worth
worrying about for most people.

Perhaps another way could be to make use of udev and wait until a mapped
device is available before starting the backend at system start...

As usual, TIMTOWTDI. :-)

Cheers, Ian
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mythtv.org/pipermail/mythtv-users/attachments/20190205/0f193f53/attachment.html>


More information about the mythtv-users mailing list