[mythtv-users] Shutdown in limbo???

Mark Lord mythtv at rtr.ca
Sun Oct 16 17:17:10 UTC 2011


On 11-10-15 09:17 PM, Craig Huff wrote:
> On Sat, Oct 15, 2011 at 5:04 PM, Mark Lord <mythtv at rtr.ca> wrote:
..
>> I also enable the hardware watchdog timer (nearly all Intel chipsets have one)
>> and it will reset the system should it ever get hung anywhere.
>>
> Sounds more like something I might do.  Is this a BIOS setting?  How
> do you do this if not?

(copying the list here too)

Most Intel motherboard chipsets have a hardware watchdog timer,
which can be managed by the Linux kernel "iTCO_wdt" driver.
The watchdog is disabled by default.  To enable it, you have to
load the kernel module and then run a program to access the timer
periodically.

The idea is that the timer has to be "kicked" periodically by
the program as an indication that all is well.  If the program
ever stops kicking the timer, it will eventually trigger
and will perform a hardware reset of the motherboard.

Here's a suitable program I wrote for this:

#include <stdio.h>
#include <errno.h>
#include <fcntl.h>
#include <sys/ioctl.h>
#include <linux/watchdog.h>
#include <unistd.h>

/*
 * Need to do "modprobe iTCO_wdt nowayout=1" *before* starting this daemon.
 */

int main (int argc, char *argv[])
{
        const char *watchdog = "/dev/watchdog";
        int fd;

        fd = open(watchdog, O_RDWR);
        if (fd == -1) {
                int err = errno;
                perror(watchdog);
                return err;
        }

        while (1) {
                ioctl(fd, WDIOC_KEEPALIVE, 0);
                sleep(10);
        }
}





More information about the mythtv-users mailing list