From owner-freebsd-questions Thu May 10 19:15:55 2001 Delivered-To: freebsd-questions@freebsd.org Received: from homer.futureuse.net (CPE-61-9-146-167.vic.bigpond.net.au [61.9.146.167]) by hub.freebsd.org (Postfix) with SMTP id 22A8637B422 for ; Thu, 10 May 2001 19:15:50 -0700 (PDT) (envelope-from fbsdlist@futureuse.net) Received: (qmail 21078 invoked by uid 65534); 26 Apr 2001 02:14:06 -0000 Received: from 165.228.131.12 (proxying for 10.140.148.30,203.11.225.10) (SquirrelMail authenticated user fbsdlist) by www.futureuse.net with HTTP; Thu, 26 Apr 2001 12:14:06 +1000 (EST) Message-ID: <49675.165.228.131.12.988251246.squirrel@www.futureuse.net> Date: Thu, 26 Apr 2001 12:14:06 +1000 (EST) Subject: RE: dmesg buffer between reboots From: "Aaron Hill" To: darryl@osborne-ind.com In-Reply-To: <001b01c0d952$246e54d0$0701a8c0@darryl> References: <001b01c0d952$246e54d0$0701a8c0@darryl> Cc: freebsd-questions@freebsd.org X-Mailer: SquirrelMail (version 1.0.5) MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: 8bit Sender: owner-freebsd-questions@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG > 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