Subject: Re: Neat feature.
To: Andrew Gillham <gillhaa@ghost.whirlpool.com>
From: Peter Seebach <seebs@plethora.net>
List: current-users
Date: 06/15/2000 19:13:33
In message <200006151559.LAA19262@ghost.whirlpool.com>, Andrew Gillham writes:
>I posted something like this a few years back. Didn't get a lot of
>interest. :(
Amusingly, your sed script is within a small epsilon of the one BSD/OS uses.
>Here is what I have been using.
>#!/bin/sh
>#
># check for changes in the hardware configuration
>#
>if [ -f /var/log/dmesglog ]; then
> echo -n 'checking hardware config:'
> mv /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
> echo ' changed.'
> else
> echo ' no change.'
> fi
> rm -f /tmp/diff.$$
>fi
I rather like this, although I'd want to use "rotate" so you could have
a few back, optionally. :)
-s