From owner-freebsd-isp Thu Feb 15 10:47:46 2001 Delivered-To: freebsd-isp@freebsd.org Received: from mail.ruhr.de (in-ruhr4.ruhr.de [212.23.134.2]) by hub.freebsd.org (Postfix) with SMTP id B6FAA37B401 for ; Thu, 15 Feb 2001 10:47:42 -0800 (PST) Received: (qmail 16677 invoked by uid 10); 15 Feb 2001 18:47:39 -0000 Received: (from ue@localhost) by nathan.ruhr.de (8.11.2/8.11.2) id f1FIYhP62459 for freebsd-isp@freebsd.org; Thu, 15 Feb 2001 19:34:43 +0100 (CET) (envelope-from ue) Date: Thu, 15 Feb 2001 19:34:42 +0100 From: Udo Erdelhoff To: freebsd-isp@freebsd.org Subject: Re: detecting uncontrolled reboot? Message-ID: <20010215193442.C97705@nathan.ruhr.de> Mail-Followup-To: freebsd-isp@freebsd.org References: <20010215121715.J91352@numachi.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.2.5i In-Reply-To: <20010215121715.J91352@numachi.com>; from reichert@numachi.com on Thu, Feb 15, 2001 at 12:17:15PM -0500 Sender: owner-freebsd-isp@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.org Moin, > Can anyone think of a way, after reboot/fsck/etc, from userland, > of detecting whether or not 'this' boot was the consequence of an > uncontrolled reboot? you could always use some kind of flag file. Recent versions of FreeBSD call all scripts in /usr/local/etc/rc.d/ with the argument "stop" when the system is shut down. Write a small script that creates the flag file when the script is called with the argument "stop". If the script is called with "start", check for the existence of the flag file. If it's there, the system is rebooting after a clean shutdown. If not, break out the repair tools. Please not that this isn't 100% proof. For a better solution, you should convert the flag file into an entry in your database. After all, you don't care if the system crashes, you only care if the system crashes while your database is running. /s/Udo -- Enjoy the beauty and power of root To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-isp" in the body of the message