Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 15 Feb 2001 19:34:42 +0100
From:      Udo Erdelhoff <ue@nathan.ruhr.de>
To:        freebsd-isp@freebsd.org
Subject:   Re: detecting uncontrolled reboot?
Message-ID:  <20010215193442.C97705@nathan.ruhr.de>
In-Reply-To: <20010215121715.J91352@numachi.com>; from reichert@numachi.com on Thu, Feb 15, 2001 at 12:17:15PM -0500
References:  <20010215121715.J91352@numachi.com>

next in thread | previous in thread | raw e-mail | index | archive | help
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




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20010215193442.C97705>