Sending Errors to A Specific Console?
Tim Chase
blinux.list at thechases.com
Mon Oct 31 01:27:20 UTC 2011
On 10/30/11 19:18, Hart Larry wrote:
> So my idea would be if first I could select a console such as
> tty22 where all error messages would go.
If you su/sudo to root, you can use "cat" to read the contents of
/proc/kmsg so for your example, I'd switch to console #22, and type
sudo cat /proc/kmsg
and all system/kernel messages should appear in this console as
they would if you were monitoring the output of "dmesg -r"
Note that the "cat" command (or the following "sed" command) both
hang awaiting additional output, so you have to use control+C to
terminate them if you're experimenting rather than just leaving
them running in the background.
> Then for those who figure its important to know of and examine
> them, maybe the PC speaker could ring 2 rapid bells.
Using the above command, you could do something like
sudo sed '/^<[6]>/&\x07\x07/' /proc/kmsg
which would send two BELL characters to this console if the
logging level (the first field in angled-brackets is the logging
level, which you can see if you use "dmesg -r") was one of the
defined set. In this case, I just log-level 6 since that gives
me most of what I would find important, but you can change it to
something like "[367]" to log levels 3, 6, and 7, or even just
sudo sed 's/^/\x07\x07/' /proc/kmsg
though this has the unfortunate side effect of ringing twice for
EVERY line printed, which I think would annoy the SNOT out of me.
<grins>
I don't know of these are the best solutions--especially the part
where it involves leaving a console open with root access if you
use "su" instead of configuring "sudo"; perhaps for this you
could chown/chmod the file like
chown :plugdev /proc/kmsg
chmod g+r /proc/kmsg
and then run it as your regular user. I don't know if this will
work for you, but hopefully it's at least a start.
-tim
More information about the Blinux-list
mailing list