Command to redirect console to my tty?


 
Thread Tools Search this Thread
Operating Systems Solaris Command to redirect console to my tty?
# 1  
Old 11-05-2009
Command to redirect console to my tty?

Is there a utility built into Solaris that will allow me to see console messages from a tty?

I've done a search and see that this is possible through software like ILOM, but I'm looking for a method to do this with built in utilities.

For example, on AIX, I can use swcons `tty`
# 2  
Old 11-05-2009
Not exactly the same but this is close:
Code:
tail -f /var/adm/messages

If your tty is a real one, you might also try:
Code:
consadm -a $(tty)

# 3  
Old 11-06-2009
use the dmesg command
# 4  
Old 11-06-2009
Quote:
Originally Posted by incredible
use the dmesg command
This shows the last lines of the message file but doesn't kind of redirect its output as the OP asked for.
# 5  
Old 11-06-2009
Quote:
Originally Posted by jlliagre
Not exactly the same but this is close:
Code:
tail -f /var/adm/messages

If your tty is a real one, you might also try:
Code:
consadm -a $(tty)

Unfortunately my tty is not a real device. I am logged in remotely using SSH.

I am managing an application that writes certain messages to console. I don't see them in /var/adm/messages. I think in the simplest form, I am trying to figure out how to access messages written to console, like:

Code:
echo "Hello World" > /dev/console

# 6  
Old 11-06-2009
Your application should use the logger facility instead of directly accessing the console. Anyway, if your application has the /dev/console steadily open, you can figure out what file descriptor it is using using pfiles:
Code:
pfiles $(pgrep application-name)

The console file descriptor (here 22) should appear this way:
Code:
  22: S_IFCHR mode:0620 dev:323,0 ino:4 uid:10001 gid:7 rdev:0,0
      O_WRONLY|O_CREAT|O_TRUNC|O_LARGEFILE
      /devices/pseudo/cn@0:console

then use truss to display what is written there like this:
Code:
truss -f -w 22 -t !all -p pid

with pid being your application process id.

If that doesn't work, say because /dev/console is open and close immediately, an alternate and interesting way would be using dtrace.
# 7  
Old 11-07-2009
not sure but may be this is OK for you...
run tty to check pts number something like this
root@solaris# tty
/dev/pts/5
root@solrais#
after you now tty number you can redirect messages like this way
echo"some message here" > /dev/pts/5
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

How to redirect the messages from the script to console in Linux?

msg.sh #!/bin/bash if then echo "starting service" else echo " service not started" echo " Please check the start.sh file or manuly start the service" fi if i login with root credentials @12.36.34.123 with passwd username:root passwd:abc once i login into linux pc... (6 Replies)
Discussion started by: saku
6 Replies

2. AIX

Console redirect to xmanager in AIX ?

Hello, Oracle PDF reports run only when you run the command # xhost + from the console, but if you run from the xmanager session , then report doesn't work running from windows pc using xmanager # xhost + access control disabled, clients can connect from any host # echo... (7 Replies)
Discussion started by: filosophizer
7 Replies

3. Shell Programming and Scripting

Redirect an output from a script to a file and display it at a console simultaneously

Hi, I'd like to redirect the STDOUT output from my script to a file and simultaneously display it at a console. I've tried this command: myscript.sh | tail -f However, it doesn't end after the script finishes running I've also tried this: myscript.sh | tee ~/results.txt But it writes... (3 Replies)
Discussion started by: wenclu
3 Replies

4. Shell Programming and Scripting

How to redirect the output of a cvs command to a file as well as the console.

Hi can anyone tell me how to redirect the ouput of a cvs command to a file as well as the console? i tried using cvs add <filename> | tee logFile cvs add <filename> 2>logFile 2>&1 All i could get is only on console or on file. Please help Thanks (2 Replies)
Discussion started by: ankitag2010
2 Replies

5. Shell Programming and Scripting

How to redirect the output to multiple files without putting on console

How to redirect the output to multiple files without putting on console I tried tee but it writes to STDOUT , which I do not want. Test.sh ------------------ #!/bin/ksh echo "Hello " tee -a file1 file2 ---------------------------- $>./Test.sh $> Expected output: -------------------... (2 Replies)
Discussion started by: prashant43
2 Replies

6. Solaris

console redirect on dl365

anyone have any success with redirecting the console running sol10 x86 on a hp dl365? (0 Replies)
Discussion started by: pupp
0 Replies

7. AIX

Difference between tty and console devices ?

Hi, What is the diference between these two ? thanks Vilius (3 Replies)
Discussion started by: vilius
3 Replies

8. Shell Programming and Scripting

console redirect of progress bar

I'm trying to write a python wrapper around wget to show the progress bar on a gui application. Wget gives you a progress bar on command line, but how would I pipe that to some "tty" that's really just a variable I read, or am I going about it all wrong? When I try to just redirect the output to a... (1 Reply)
Discussion started by: unclecameron
1 Replies

9. UNIX for Advanced & Expert Users

Send console message to all users and tty

Hi people, i tried to search in the forum... but didnt found the answer... Sometimes i need to send a console message to all users in all tty, like reboot or shutdown does... But i cant find how to do that. Someone know? Thanks a lot (2 Replies)
Discussion started by: gfca
2 Replies

10. UNIX for Dummies Questions & Answers

stdin not tty when try to pine or redirect

My supervisor keep getting "stdin not tty" or something like that when he pipe or redirect input into a program. Others don't seem to get this message. Is there some way I can help him to fix or turn this off? Thx in advance (1 Reply)
Discussion started by: Micz
1 Replies
Login or Register to Ask a Question