Subject: save old dmesg outputs
To: None <tech-userlevel@netbsd.org>
From: Jeremy C. Reed <reed@reedmedia.net>
List: tech-userlevel
Date: 07/29/2006 05:45:53
On my Linux systems, for a couple years my /etc/rc.d/dmesg has:
#!/bin/sh
#
# PROVIDE: dmesg
# REQUIRE: mountcritremote
# BEFORE: DAEMON
# todo: maybe save to /var/run and copy to /var/log first
. /etc/rc.subr
name="dmesg"
rcvar=$name
dmesg_file="/var/log/dmesg.boot"
start_cmd="do_dmesg"
stop_cmd=":"
do_dmesg()
{
# keep only a few rotations
[ -e "${dmesg_file}.1" ] && cp -pf ${dmesg_file}.1 ${dmesg_file}.2
[ -e "${dmesg_file}.0" ] && cp -pf ${dmesg_file}.0 ${dmesg_file}.1
cp -pf ${dmesg_file} ${dmesg_file}.0
( umask 022 ; dmesg $rc_flags > ${dmesg_file} )
}
load_rc_config $name
run_rc_command "$1"
May I update src/etc/rc.d/dmesg to save a few older versions?
Should it be a setting like: dmesg_backup_count=3 and I will save up to
that many old versions?
This has been quite useful for me. (And will take little space.)
I recall that my BSD/OS systems also saved previous versions of the boot
messages too.
Should it save them under /var/run/ or /var/log/?
I know that /var/log/messages keeps same, but on long running systems, by
default, you will lose your old dmesg output.
Any thoughts on this?
Jeremy C. Reed