[mythtv-users] Way to tell BE came up after power fail?

R. G. Newbury newbury at mandamus.org
Wed Oct 30 21:22:39 UTC 2013


On 10/29/2013 08:18 AM, stinga wrote:
> On 28/10/13 20:18, Craig Huff wrote:
>> I'd still like a better way to tell that the system came up due to
>> power being restored, but at this point it looks like I'd have to pull
>> out a soldering iron and build a flip-flop tied to an unused signal
>> line (e.g. CTS/RTS on a serial port) and resettable under program
>> control such that the signal is set when power fail / restore occurs
>> and gets cleared by program control after using the info to do
>> appropriate processing (e.g. re-enable shutdowns).
>>
>> If anyone reads this and has an idea for an existing way to detect
>> boot-up on power restore, I'd love to hear about it (e.g. BIOS info or
>> something gleaned from somewhere in the /sys or /proc subdirectory
>> trees).
1)
A two-stage scripted system,
Main part runs under cron every minute/5 minutes whatever. The cron runs 
a script which calls 'uptime > /home/mythtv/uptimer'.

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.
If you have a 'old' the system has rebooted, and you can tell how long 
ago from the new uptimer.


2)
Or something like this, using cron OR an init-script:
The cron first writes uptime to /home/mythtv/uptimer
The cron then attempts to copy /home/mythtv/uptimer to /tmp/uptimer/uptimer

After a reboot /tmp/uptimer will not exist and an error will be raised.
The error condition requires operator action to clear.

Post-notification handling is left to the student as an exercise!


Geoff
-- 
              R. Geoffrey Newbury			
            Mandamus Publishing Inc.
       Suite 106, 150 Lakeshore Road West
          Mississauga, Ontario, L5H 3R2

               www.mandamus.ca

         t416-479-0930 f905-271-1638
               rgn at mandamus.ca


More information about the mythtv-users mailing list