Logging console messages to a printer.

T. William Wells bill at twwells.com
Fri Jan 5 22:04:04 AEST 1990


In article <1052 at rsiatl.UUCP> jgd at rsiatl.UUCP (John G. De Armond) writes:
: I should not have neglected to mention in my first post that I had figured
: out how to use /dev/osm for kernal messages.  What I'm wanting to do is more
: general.  I want to send everything that currently goes to /dev/console
: to a logging printer just as if /dev/console were a KSR terminal.  At the
: same time, I'd like to STOP the printing of messages to the real /dev/console.
: I guess one solution WOULD be to just hang a KSR terminal (Decwriter, anyone?)
: on a port and re-mknod /dev/console to that port.  I was hoping there is an
: undocumented (of course), but elegant way of solving this problem.  I'm
: working on an inelegant solution (the one true unix way) but I'd hoped
: for more.

How about:

	(setup)

	mv /dev/console /dev/realcons
	mknod /dev/console p
	chmod 622 /dev/console

	(to actually use this:)

	dd bs=1 if=/dev/console of=/dev/lp >/dev/null 2>&1 &

Why dd? Because cp buffers its I/O. Of course, you could put
anything on the other end of the pipe.

Oh yes, if I read the manual correctly, you have to have something
holding /dev/console open for write or the dd will get EOF. You might
make the last command

	dd bs=1 if=/dev/console of=/dev/lp >/dev/null 2>&1 3>/dev/console &

instead.

---
Bill                    { uunet | novavax | ankh | sunvice } !twwells!bill
bill at twwells.com



More information about the Comp.unix.i386 mailing list