Subject: Re: Neat feature.
To: Steve Woodford <scw@netbsd.org>
From: Andreas Wrede <andreas@planix.com>
List: current-users
Date: 06/15/2000 13:42:28
On Thu, 15 Jun 2000, Steve Woodford wrote:

> On Thu, 15 Jun 2000 erh@nimenees.com wrote:
> 
> > or with the compare-it-first idea:
> > 	if ! cmp -s /var/log/dmesg.boot /var/log/dmesg.boot- ; then
> > 		mv ...
> > 		dmesg ... > ...
> > 	fi
> > so you actually keep the last different dmesg output.
> 
> Comparing dmesg output across reboots is going to produce a whole bunch of
> diffs on those architectures where the message buffer doesn't get stomped
> on across reboots.

Maybe like this:

        mv -f /var/log/dmesglog /var/log/dmesglog.0
        dmesg | sed -n '/^NetBSD/h; /^NetBSD/!H; ${ x; p; q; }' \
                > /var/log/dmesglog
        diff -bc /var/log/dmesglog.0 /var/log/dmesglog > /tmp/diff.$$ 
        if [ -s /tmp/diff.$$ ]; then
                cat /tmp/diff.$$ | Mail -s "hardware change" root
        fi
        rm -f /tmp/diff.$$

-- 
    - aew