Logging bootscript output
bruce.dubbs at gmail.com
Thu Feb 22 13:14:33 PST 2007
Vladimir A. Pavlov wrote:
> Just a few notes.
Thanks for the input.
> 2. May be it would be better if /etc/rc.d/rc (I mean the main rc
> script. I don't remember how it's called in LFS) will run each
> bootscript using
> script_name 2>&1 |tee -a /var/log/bootlog
> rather then simply
I thought about this, but it is possible that /var is not mounted early
in the boot process, however using my script to buffer messages might work:
script_name 2>&1 |tee /dev/bootlog
> Then, if we will also use lecho for echo'ing messages with
> timestamps then /var/log/bootlog will contain both bootscript
> messages with timestamps automatically added and output of other
> utilities like mount and fsck.
> I think such a detailed log would be much more helpful in different
> situations then just the messages the bootscripts write themselves
> using echo (or even lecho).
I agree. I wanted to do something like the above from the beginning,
but my first thought was about buffering the output. Integrating it
into rc is a good way to generalize without making lots of changes. The
only minor problem I see is that tee would need to be moved from
/usr/bin to /bin.
> Though, I don't know if this will work as expected if using C-s/C-q
> during system boot to stop/continue service starting (using these is
> very useful for viewing messages "on-line" if something goes wrong
> upon boot). In general, I don't know what if a user need to interact
> with a system (for example, operate with fsck in case of a
> filesystem crash) when bootscripts use tee.
don't know either. It would require testing. However, we are not
changing input at all, so C-s/C-q should stop the process.
> 3. It would be also fine if each bootscript will be able to log its
> output even when being run directly (for example
> "/etc/rc.d/init.d/apache2 restart" from the console), not upon
> system boot.
> With your implementation that means we must not remove /dev/bootlog
> and kill /bin/bootlog.sh (writing to /var/log/bootlog) after system
> has been booted.
Actually I was thinking about removing /dev/bootlog as the last step of
the boot.sh script. I don't see it needed after a login prompt.
More information about the lfs-dev