On Wednesday, October 30, 2013, R. G. Newbury wrote:<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
1)<br>
A two-stage scripted system,<br>
Main part runs under cron every minute/5 minutes whatever. The cron runs a script which calls 'uptime > /home/mythtv/uptimer'.<br>
<br>
The other part is a line in /etc/rc.d/rc.local (or some other initscript) which renames /home/mythtv/uptimer to uptimer-old on boot.<br>
If you have a 'old' the system has rebooted, and you can tell how long ago from the new uptimer.<br>
<br>
<br>
2)<br>
Or something like this, using cron OR an init-script:<br>
The cron first writes uptime to /home/mythtv/uptimer<br>
The cron then attempts to copy /home/mythtv/uptimer to /tmp/uptimer/uptimer<br>
<br>
After a reboot /tmp/uptimer will not exist and an error will be raised.<br>
The error condition requires operator action to clear.<br>
<br>
Post-notification handling is left to the student as an exercise!<br>
<br>
<br>
Geoff<br>
</blockquote><div><br></div><div><br></div><div>Geoff-</div><div><br></div><div>Thanks for the idea. Unfortunately, in my case (OP), the problem arises when the system is down on purpose -- nothing to do -- and power is removed. In this case, my system is configured to wake up when power is restored. This had two issues: how to tell the system came up due to a power interruption as opposed to a user wanting to do something off-schedule (e.g. Watch something), and get the IR Transmitter/Receiver configuration fixed (it consistently fails the first time up after power interruption). My solution to both problems is not robust in that it depends on continued misbehavior that most likely will get fixed in some newer version of the O/S or LIRC SW.</div>
<div><br></div><div>What would be ideal would be a way to find out programmatically from the BIOS that the system was brought up on power restore, not the "On" switch, WOL, etc.</div><div><br></div><div>In any case thanks for taking the time to make the suggestion. It may give someone else an idea how to solve a variant of the situation.</div>
<div><br></div><div>--</div><div>Craig.<span></span> </div>