we have three different console servers at coraid.
so i've changed how consoles and console logging
works.  maybe this will be useful to other people.

here are the changes that make this work
1. instead of consoledb use /lib/ndb/consoledb.$sysname.
and have a general test for this new file in cpurc.
        if(test -f /lib/ndb/consoledb.$sysname){
                aux/consolefs -c /lib/ndb/consoledb.$sysname
                startclog
        }
2. startclog (attached) uses a new consoledb tuple
clog=$sysname, e.g. from /lib/ndb/consoledb.baron
        console=ila dev=/dev/eia5
                gid=sys
                clog=baron

(the -r flag is part of a very sneaky trick involving booting
from a skeleton kfs and binding large bits of the namespace
back via aan so that the console logger can survive loosing
its connection to the fs without having console logging
end up someplace other than the man fs.  the way to start
it is startclog; startclog -r.  this setup survived a switch gone
wild a few weeks ago.)

3. add the directory /sys/log/clog & create the console
files you wish.

- erik
#!/bin/rc
rfork e
rflag=0
if(~ $1 -r)
        rflag=1
cd /mnt/consoles
for(i in *){
        x = `{ndb/query -f/lib/ndb/consoledb.$sysname console $i clog}
        if(~ $rflag 0 && ~ $x $sysname){
                log=/sys/log/clog/$i
                if(~ $rflag 1){
                        mkdir -p /tmp/clog
                        log=/tmp/clog/$i
                }
                while(~ 1 1){
                        echo aux/clog $log /mnt/consoles/$i
                        aux/clog /mnt/consoles/$i $log && echo clog exits 
$status
                        sleep 10;
                }
        }&
}
fn rotate{
        rm /tmp/oclog/*
        cp /tmp/clog/* /tmp/oclog
        rm /tmp/clog/*
}
if(~ $rflag 1){
        mkdir -p /tmp/oclog /tmp/clog
        while(~ 1 1){
                sleep 600
                s=`{du -a /tmp/clog| sed 's/[   ].*//g'}
                if(test $s -gt 10000)
                        rotate
        }
}&

Reply via email to