From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from pigeon.gentoo.org ([69.77.167.62] helo=lists.gentoo.org) by finch.gentoo.org with esmtp (Exim 4.60) (envelope-from ) id 1Jj0nQ-0007dH-HW for garchives@archives.gentoo.org; Mon, 07 Apr 2008 23:30:40 +0000 Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id 672F9E02FB; Mon, 7 Apr 2008 23:30:38 +0000 (UTC) Received: from mail.netspace.net.au (mail-out5.netspace.net.au [203.10.110.92]) by pigeon.gentoo.org (Postfix) with ESMTP id 19AC2E02FB for ; Mon, 7 Apr 2008 23:30:38 +0000 (UTC) Received: from [172.16.0.52] (ppp246-231.static.internode.on.net [203.122.246.231]) by mail.netspace.net.au (Postfix) with ESMTP id 1731B172EF7 for ; Tue, 8 Apr 2008 09:30:35 +1000 (EST) Subject: Re: [gentoo-user] Re: Emergency shutdown, how to? From: Iain Buchanan To: gentoo-user@lists.gentoo.org In-Reply-To: <47FA59DA.9090404@wrkhors.com> References: <47EC9F50.5070503@bellsouth.net> <200804021549.15550.dirk.heinrichs.ext@nsn.com> <3297039.CL3N7pcUCC@schmarck.cn> <200804021628.29507.dirk.heinrichs.ext@nsn.com> <28748152.K45aiMzFyV@michael-schmarck.my-fqdn.de> <20080402184829.1c6d2b9c@zaphod.digimed.co.uk> <5bdc1c8b0804041405u6f3fdef1r802963828f3bf8c5@mail.gmail.com> <47F7AC03.6010101@wrkhors.com> <1207530457.15340.11.camel@orpheus> <47FA59DA.9090404@wrkhors.com> Content-Type: text/plain Date: Tue, 08 Apr 2008 08:59:42 +0930 Message-Id: <1207610982.15340.50.camel@orpheus> Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-user@lists.gentoo.org Reply-to: gentoo-user@lists.gentoo.org Mime-Version: 1.0 X-Mailer: Evolution 2.22.0 Content-Transfer-Encoding: 7bit X-Archives-Salt: 018a5696-5ca0-413b-b322-6d4dcfd8af29 X-Archives-Hash: 8952ecc4899d98e122a47838d6052e8d 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 Linux - Where do you want to fly today? -- Unknown source -- gentoo-user@lists.gentoo.org mailing list