On Tue, 12 Oct 2004 21:30:36 +0200
"Julio M. Merino Vidal" <jmmv@menta.net> wrote:
> Hi all,
>
> I've been doing some cosmetic changes to the rc.d scripts, based on what I've
> seen lately on multiple Linux distributions.
[snip]
I'm personally happy with existent spartan boot messages. They gives
just all needed info, isn't it?
> The second change is the addition of a prefix to "important" messages.
> For example, consider the dhclient script: a typical run shows a
> "Starting dhclient." message followed by the output of the command. This
> is confusing, because it's hard to associate all that output to a given
> rc.d script (ok, ok, in this case it's easy, but there are other situations
> where it's not).
[snip]
This may have a sense, especially in parallel boot framework (if it will
be implemented). However, as it already proposed by Greywolf, IMHO it's
better prepended with service name rather "=>" symbols.
But it would be really good to have a boot log after restart. For
example, it often needed to see if some services starts properly. There
are situations when some rc.d/foo starts with incorrect (for example,
syntax) errors and there are no way to see what happens, especially if
this faulty service starts on remote server.
I'm faced with this problem just yesterday and dirty hack it within
following changes:
--- rc.orig 2004-10-13 13:04:37.000000000 +0300
+++ rc 2004-10-13 13:05:07.000000000 +0300
@@ -35,13 +35,20 @@
trap : INT
trap "echo 'Boot interrupted.'; exit 1" QUIT
-date
+rclog date
files=$(rcorder -s nostart ${rc_rcorder_flags} /etc/rc.d/*)
for _rc_elem in $files; do
- run_rc_script $_rc_elem start
+ rclog "run_rc_script $_rc_elem start"
done
-date
+rclog date
+
+if [ -d /var/log ]; then
+ echo "${rclogvar}" >> /var/log/boot.log
+else
+ warn "Can not save boot log."
+fi
+
exit 0
--- rc.subr.orig 2004-10-13 13:04:37.000000000 +0300
+++ rc.subr 2004-10-13 13:05:07.000000000 +0300
@@ -819,6 +819,21 @@
}
#
+# rclog command
+# Run "command" and append all output to $rclogvar variable.
+#
+rclog ()
+{
+ _command=$1
+ _rclogvar=$(${_command} 2>&1)
+ if [ -n "$_rclogvar" ]; then
+ echo "$_rclogvar"
+ rclogvar="${rclogvar}
+${_rclogvar}"
+ fi
+}
+
+#
# backup_file action file cur backup
# Make a backup copy of `file' into `cur', and save the previous
# version of `cur' as `backup' or use rcs for archiving.
Of course, it may be easy prolonged on /etc/rc.shutdown too. Another
change should be a dependency on "rc_boot_log" variable used in rclog().
Any comments, please?
--
Best wishes,
Mishka.