Logging bootscript output

Bruce Dubbs bruce.dubbs at gmail.com
Wed Feb 21 18:33:47 PST 2007


I've been doing a bit of thinking about logging bootscript output.

If the first script that ran (S00bootlog) was something like this:

mknod -m600 /dev/bootlog p
/bin/bootlog.sh < /dev/bootlog &

Where bootlog.sh is something like:

#!/bin/bash

i=0

while read line; do
  if [ $line == 'fini' ]; then break; fi

  time=$(date +%T)
  l[$i]="$time $line"
  i=$(($i+1))
done

j=0

while [ $j -lt $i ]; do
  echo ${l[$j]}      # >> /var/log/bootlog
  j=$(($j+1))
done
###########
And then S99logboot would be:

echo "fini" > /dev/bootlog
sleep 1            # removing /dev/bootlog may not be necessary
rm /dev/bootlog

All the scripts would have to be modified to send their output to
/dev/bootlog as well as the screen, but it may get the job done.

I've tried it from the command line, but the read fails after the first
write to /dev/bootlog so the most I get is one line out, but if that can
be overcome it might work.

What do you think?

  -- Bruce



More information about the lfs-dev mailing list