Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 26 Apr 2001 12:14:06 +1000 (EST)
From:      "Aaron Hill" <fbsdlist@futureuse.net>
To:        darryl@osborne-ind.com
Cc:        freebsd-questions@freebsd.org
Subject:   RE: dmesg buffer between reboots
Message-ID:  <49675.165.228.131.12.988251246.squirrel@www.futureuse.net>
In-Reply-To: <001b01c0d952$246e54d0$0701a8c0@darryl>
References:  <001b01c0d952$246e54d0$0701a8c0@darryl>

next in thread | previous in thread | raw e-mail | index | archive | help

> dmesg > dmesg_sav.  Puts the contents into a file name for
> preservation.  The question then becomes, how to automate
> it so that it is done everytime before shutdown.  
> 
> -Darryl

Remember that any scripts in /usr/local/etc/rc.d are executed with the 
argument stop when the system shuts down. So if you wanted to save dmesg on 
each shutdown/reboot you could create a file called savedmesg.sh in that 
directory with the following contents ...

#!/bin/sh

# This script saves the dmesg on shutdown

# only run on system shutdown
if [ "$1" = "stop" ]; then
      dmesg > /var/log/dmesg.`date '+%d%m%y.%H%M'`
fi


You would get dmesg saved to a file reflecting the date and time everytime 
you shutdown the machine. The filename would look 
like /var/log/dmesg.110501.1210 for the 11th day of the 5th month in the 
year 01, time 12:10. Obviously reverse the day and month around to suit 
your standards.

Don't forget to make the file executable:
   chmod 750 /usr/local/etc/rc.d/savedmesg.sh


Yeah I know it's rough.  :-)

Aaron






To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-questions" in the body of the message




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