<div dir="auto"><div><br><br><div class="gmail_quote"><div dir="ltr">On Tue, 5 Feb 2019 16:29 Stephen Worthington <<a href="mailto:stephen_agent@jsw.gen.nz">stephen_agent@jsw.gen.nz</a> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">On Tue, 5 Feb 2019 15:47:20 +0530, you wrote:<br>
<br>
>On Tue, 5 Feb 2019 15:08 Stephen Worthington <<a href="mailto:stephen_agent@jsw.gen.nz" target="_blank" rel="noreferrer">stephen_agent@jsw.gen.nz</a><br>
>wrote:<br>
><br>
>> I do not know of any way for Linux to know that it has had a power<br>
>> failure or similar bad shutdown.<br>
>><br>
><br>
>You could script it, maybe touch a file on successful shutdown in non<br>
>volatile storage, perhaps by modifying the backend unit file. On startup,<br>
>if file exists, shutdown was clean, delete the file and carry on. If the<br>
>file does not exist, sleep for x time and then carry on.<br>
><br>
>Cheers, Ian<br>
<br>
Except that you can not touch files after the filesystem has been shut<br>
down.  And if you touch a file before the shutdown, you can still get<br>
a bad shutdown that happens after that point.  In this particular<br>
case, you can also get the case where the power goes off while the<br>
MythTV box is down for maintenance (eg kernel upgrade).  But setting a<br>
flag like that does reduce the window of time when things can happen<br>
without the system knowing about it.<br></blockquote></div></div><div dir="auto"><br></div><div dir="auto">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. </div><div dir="auto"><br></div><div dir="auto">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... </div><div dir="auto"><br></div><div dir="auto">As usual, TIMTOWTDI. :-)</div><div dir="auto"><br></div><div dir="auto">Cheers, Ian</div><div dir="auto"><br></div><div dir="auto"><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
</blockquote></div></div></div>