Subject: Re: Saving a copy of boot messages?
To: Michael K. Sanders <msanders@confusion.net>
From: Tom Ivar Helbekkmo <tih@nhh.no>
List: current-users
Date: 11/05/1998 11:17:17
"Michael K. Sanders" <msanders@confusion.net> writes:

> 146a147,149
> > # save a copy of the boot messages
> > /sbin/dmesg > /var/run/dmesg.boot

I run with the following in my /etc/rc.local -- I don't remember who
posted it, but I picked it up from this list some time back:

if [ -f /var/log/dmesglog ]; then
	echo -n 'checking hardware config:'
	mv -f /var/log/dmesglog.3 /var/log/dmesglog.4
	mv -f /var/log/dmesglog.2 /var/log/dmesglog.3
	mv -f /var/log/dmesglog.1 /var/log/dmesglog.2
	mv -f /var/log/dmesglog.0 /var/log/dmesglog.1
	mv -f /var/log/dmesglog /var/log/dmesglog.0
	dmesg | tail -r | sed /^NetBSD/q | tail -r > /var/log/dmesglog
	rm -f /tmp/diff.$$
	diff -bc /var/log/dmesglog.0 /var/log/dmesglog > /tmp/diff.$$ 
	if [ -s /tmp/diff.$$ ]; then
		cat /tmp/diff.$$ | Mail -s "Hardware change detected" root
		echo ' changed.'
	else
		echo ' no change.'
	fi
	rm -f /tmp/diff.$$
fi

-tih
-- 
Popularity is the hallmark of mediocrity.  --Niles Crane, "Frasier"