Date: Sat, 25 Nov 2000 18:50:05 -0800 (PST) From: Cyrille Lefevre <root@gits.dyndns.org> To: freebsd-bugs@FreeBSD.org Subject: Re: conf/14931: rc logging facility Message-ID: <200011260250.SAA07326@freefall.freebsd.org>
next in thread | raw e-mail | index | archive | help
The following reply was made to PR conf/14931; it has been noted by GNATS.
From: Cyrille Lefevre <root@gits.dyndns.org>
To: freebsd-gnats-submit@FreeBSD.org
Cc:
Subject: Re: conf/14931: rc logging facility
Date: Sun, 26 Nov 2000 03:47:55 +0100 (CET)
updated version of the original PR. I'm using it for month w/o any problems.
that's permit to me to know what's happen at boot time even if I'm not front
to the console. maybe this one could be commited until something much better
exists ?
PS : this script relies on script which lives on the /usr filesystem.
if /usr/bin doesn't exists, nothing is logged. a possible solution is
to have a static linked script living in /bin.
Index: defaults/rc.conf
===================================================================
RCS file: /home/ncvs/src/etc/defaults/rc.conf,v
retrieving revision 1.53.2.13
diff -u -r1.53.2.13 rc.conf
--- defaults/rc.conf 2000/11/11 20:33:40 1.53.2.13
+++ defaults/rc.conf 2000/11/26 02:38:33
@@ -19,6 +19,8 @@
### Important initial Boot-time options ####################
##############################################################
+rc_log_enable="YES" # enable rc logging facility
+rc_debug_enable="NO" # enable rc debug (trace) facility
swapfile="NO" # Set to name of swapfile if aux swapfile desired.
apm_enable="NO" # Set to YES to enable APM BIOS functions (or NO).
apmd_enable="NO" # Run apmd to handle APM event from userland.
Index: rc
===================================================================
RCS file: /home/ncvs/src/etc/rc,v
retrieving revision 1.212.2.8
diff -u -r1.212.2.8 rc
--- rc 2000/10/30 10:40:10 1.212.2.8
+++ rc 2000/10/31 03:46:45
@@ -158,6 +158,13 @@
sh ${diskless_mount}
fi
+# log rc.* messages.
+#
+if [ -r /etc/rc.bootlog ]; then
+ . /etc/rc.bootlog
+fi
+# DO NOT DELETE THIS LINE -- rc.boot uses it
+
adjkerntz -i
purgedir() {
----------=========--------- /etc/rc.bootlog ----------=========---------
# Copyright (c) 2000 Cyrille Lefevre
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
# 1. Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
# 2. Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in the
# documentation and/or other materials provided with the distribution.
#
# THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
# ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
# SUCH DAMAGE.
#
# log rc.* messages.
#
case ${rc_log_enable:-YES} in
[Yy][Ee][Ss])
if [ -f $0 ]; then
rc_file=$0
else
rc_file=
fi
if [ -d /usr/bin ]; then
rc_usrbindir=/usr/bin
else
rc_usrbindir=
fi
if [ -d /var/tmp -a -w /var/tmp ]; then
rc_tmpfile=/var/tmp/rc.tmp
elif [ -w /etc ]; then
rc_tmpfile=/etc/rc.tmp
else
rc_tmpfile=
fi
# Do not use /var/run, it is cleaned by rc.bootlog.
#
if [ -d /var/log -a -w /var/log ]; then
rc_logfile=/var/log/rc.log
rc_symlink=/etc/rc.log
elif [ -w /etc ]; then
rc_logfile=/etc/rc.log
rc_symlink=
else
rc_logfile=
rc_symlink=
fi
case ${rc_debug_enable:-NO} in
[Yy][Ee][Ss])
rc_debug='s/$/ -x/'
;;
*)
rc_debug=
;;
esac
rc_tag="# DO NOT DELETE THIS LINE -- rc.bootlog uses it"
if [ "X${rc_file}" != X -a "X${rc_usrbindir}" != X -a \
"X${rc_tmpfile}" != X -a "X${rc_logfile}" != X ] &&
grep -q "${rc_tag}" "${rc_file}" &&
sed -n "1${rc_debug}p
/^[^#]*rc.conf/p
/${rc_tag}/,\${
s/${rc_tag}/fi/
p
}" "${rc_file}" > "${rc_tmpfile}" &&
[ -s "${rc_tmpfile}" ]; then
if [ -f "${rc_logfile}" ]; then
mv ${rc_logfile} ${rc_logfile}.old
fi
if [ "X${rc_symlink}" != X ]; then
if [ -f "${rc_symlink}" ]; then
mv ${rc_symlink} ${rc_symlink}.old
fi
if [ ! -L "${rc_symlink}" ]; then
ln -s ${rc_logfile} ${rc_symlink}
fi
fi
touch ${rc_logfile}
chmod 664 ${rc_logfile}
chmod 755 ${rc_tmpfile}
SHELL=${rc_tmpfile} script ${rc_logfile}
rc_status=$?
rm ${rc_tmpfile}
exit ${rc_status}
fi
;;
esac
----------=========--------- /etc/rc.bootlog ----------=========---------
Cyrille.
--
home: mailto:clefevre@citeweb.net work: mailto:Cyrille.Lefevre@edf.fr
To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-bugs" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200011260250.SAA07326>
