Logging bootscript output

Vladimir A. Pavlov pv4 at bk.ru
Thu Feb 22 12:30:37 PST 2007


Just a few notes.

1. What exactly do you wish to log? Only the messages like "The script
   started" and "The script stopped" or everything a script usually
   prints on the screen?

   Your implementation seems to only log the former messages. For this
   purpose a special function is usually used in other distros (let's
   call it further lecho, the LFS echo :) ) that writes its argument
   to both the screen and a file (for example, /var/log/bootlog).

   Using this way doesn't allow to log the output messages of the
   commands run in bootscripts (like mount and fsck).

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

script_name

   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).

   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.

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.

-- 
Nothing but perfection

Vladimir A. Pavlov



More information about the lfs-dev mailing list