On Mon, 2008-04-07 at 13:28 -0400, Steven Lembark wrote: > Iain Buchanan wrote:
> > watchdogs are nice, and linux makes them ultra-easy to program, but of > > course if your watchdog task dies, then the machine effectively hits the > > reset button for you - no nice shutdown whatsoever! (Which is what you > > want in a hard lock-up, but not if your programming skills are the cause > > of the problem :) > > - Have the system turn off the watchdog if the file is > closed. maybe, maybe not :) I personally like setting CONFIG_WATCHDOG_NOWAYOUT on systems with hardware watchdogs, especially remote unattended systems. Usually your watchdog task never dies on such a system, and when it does (be it from a nice kill or not) you want the watchdog to fire. However if this is a semi-used system (you ssh or log-in to it in any way to do stuff) you may not want this. > - After that just open it and poke a bit out now and > then. > > - Make a point of closing the file on exit. > > #!/usr/bin/perl > > use strict; > > open my $fh, '<', '/path/to/watchdog/file' it's usually /dev/watchdog if you're using the linux kernel interface. I agree that your script is nice and simple, and hence less prone to errors. I coded mine in c++ because I use it not only for a machine type watchdog, but also a task based watchdog that reboots the machine based on certain tasks living or not. Each task has to register with the watchdog server and continually tell the server they're alive, or reboot! But that's a story for another thread... -- Iain Buchanan <iaindb at netspace dot net dot au> Linux - Where do you want to fly today? -- Unknown source -- gentoo-user@lists.gentoo.org mailing list