Msg before exiting pseudo-console


 
Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers Msg before exiting pseudo-console
# 1  
Old 10-04-2010
Data Msg before exiting pseudo-console

Hi! I want to display a message when I leave a pseudo-console (/dev/ptsX: konsole, xterm) e.g "Bye! There's still 3 pts open and 3 background processes"
I can do it in login-terminals (via .bash_logout) but not in a non-login...
Any ideas?
# 2  
Old 10-05-2010
Why would you want to message a non-login terminal? Your messages could end up in places they're unneeded and unwanted.
# 3  
Old 10-05-2010
Quote:
Originally Posted by Corona688
Why would you want to message a non-login terminal? Your messages could end up in places they're unneeded and unwanted.
My work is mostly with non-login terminals. I just want to get some information when I leave an xterm.. that's all. It's my personal use unix system I'm not dealing with clients, other users, etc.
# 4  
Old 10-06-2010
It's the shell which is told to do things on logout, not anything fundamental to the terminal. If you're not running shells in these terminals, what are they doing?
This User Gave Thanks to Corona688 For This Post:
# 5  
Old 10-16-2010
Thanks for your response! Yes, you're right I'm running shells in these psudo-terminals. Is there a way the shell to know if it's running on a system console /dev/ttyX or a psudo-terminal (/dev/ptsX)?
# 6  
Old 10-16-2010
A close look at the contents of /proc/self/fd could help.

Code:
$ ls -l /proc/self/fd/
total 0
lrwx------ 1 monttyle monttyle 64 Oct 16 20:59 0 -> /dev/pts/0
lrwx------ 1 monttyle monttyle 64 Oct 16 20:59 1 -> /dev/pts/0
lrwx------ 1 monttyle monttyle 64 Oct 16 20:59 2 -> /dev/pts/0
lr-x------ 1 monttyle monttyle 64 Oct 16 20:59 3 -> /proc/18647/fd

...but when I do so from a physical console I get things like /dev/tty1.

Last edited by Corona688; 10-17-2010 at 12:00 AM.. Reason: fixed typo in path
This User Gave Thanks to Corona688 For This Post:
 
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Linux

Linux extacting msg from script to console

how to get the outout from script to console. i am running one script msg.sh using cron job every suday midnight. as soon as i logged in i want to see the staus is service started or service failed on console. what command i need to add to script ? msg.sh #!/bin/bash if then echo... (1 Reply)
Discussion started by: saku
1 Replies

2. AIX

Error msg

When i run errpt -a, the output was below: --------------------------------------------------------------------------- LABEL: DMPCHK_NOSPACE IDENTIFIER: F89FB899 Date/Time: Tue Jan 17 15:00:02 BEIS Sequence Number: 28998 Machine Id: 0058C0CE4C00 Node Id: ... (2 Replies)
Discussion started by: Ivanku
2 Replies

3. UNIX for Dummies Questions & Answers

Windows to Linux remote console using VNC brings up blank console screen with only mouse pointer

:confused:Hi This was installed on the Linux box a few weeks back by a guy that no longer works for us. All worked fine until last week. Now when we connect its just a blank screen with no icons. I get a whole bunch of errors when starting the service too: Tue Feb 23 14:29:45 2010 ... (1 Reply)
Discussion started by: wbdevilliers
1 Replies

4. UNIX for Advanced & Expert Users

console /dev/console get image

We are using software (Pegasys) which runs on SunOS 5.8 and reads images from a Philips nuclear camera. The software is designed to run from the console. I need to be able to capture the images it produces on the display. The caveat is that I cannot use the X Windows display because the X Server... (3 Replies)
Discussion started by: sreyes27
3 Replies

5. UNIX for Advanced & Expert Users

Getting 'Killed' msg

Can anyone explain? I start my unix session on AIX, run tcsh move to a particular directory, let say: cd /test/bin and next i run a command like: grep "test string" /test/bin/* to look for the string in any files in the directory. I am getting a response of Killed. Why is that... (16 Replies)
Discussion started by: gio001
16 Replies

6. Solaris

pseudo: [ID 129642 kern.info] pseudo-device: vol0

Hi I have a system that gave me some messages on bootup that I was not used to seeing: pseudo: pseudo-device: vol0 genunix: vol0 is /pseudo/vol@0 these came with these: Feb 13 17:42:17 system1 eri: SUNW,eri0 : 100 Mbps full duplex link up Feb 13 17:42:21 system1sendmail: My unqualified... (0 Replies)
Discussion started by: mndavies
0 Replies

7. Shell Programming and Scripting

msg??

I want to display a message when the script is done running, but I do not want to use echo. Is there another command I can use besides echo? If so, show me how it is done. (1 Reply)
Discussion started by: dshea0001
1 Replies

8. Programming

msg q

hi... i posted the code earlier but it wasnt quite readbale... ive added a few comments and made the indentation problem right... the problem is that it doent seem to be working... ive almost pulled out my hair tryin to fix the prob another wierd thing is that it worksthe 1st time when i... (0 Replies)
Discussion started by: strider
0 Replies

9. Programming

msg q again!

is it possible to use a msg queue with multiple threads spawned from the same app? (1 Reply)
Discussion started by: strider
1 Replies

10. IP Networking

Netstat msg

What do you think of the netstat msg about : udp 2320 0 *:xdmcp *:* The 2320? Does that mean an error? I used netstat -l | grep 'xdmcp' to get that, but does the 2320 indicate an error? I'm trying to figure out why, after i've enabled xdmcp to true, it is still not showing up... (2 Replies)
Discussion started by: kymberm
2 Replies
Login or Register to Ask a Question