Subject: hardware check in /etc/rc.local?
To: None <current-users@NetBSD.ORG>
From: Andrew Gillham <firstname.lastname@example.org>
Date: 09/05/1996 01:04:53
After seeing a BSDI system send mail to root because of a hardware
change, I decided I wanted my system to do the same thing.. :)
Is this a feature that others might like in /etc/rc.local? Basically
it just diffs the current output of 'dmesg' against the 'last' version.
This will show any new devices that were added, or if any are missing.
Also it would show if the kernel verison was different, etc.
I whipped up an addition to my /etc/rc.local (below) that checks
dmesg, only if /var/log/dmesglog exists. It is fairly simple, and
can be very useful if a network card drops out, or serial port, etc.
Drives/controllers also, but fsck usually finds those problems. :-)
--- addition to /etc/rc.local ---
if [ -f /var/log/dmesglog ]; then
echo -n 'checking hardware config:'
mv /var/log/dmesglog /var/log/dmesglog.0
dmesg > /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.'
echo ' no change.'
rm -f /tmp/diff.$$
--- end of addition ---