Does the bash shell store signal traps between sessions?
Web Server forum
Back To The Forum Home!Search!Private Messaging System

Web Server Talk Web Server Talk > Unix and Linux reviews > Free Unix support > Unix Programming > Does the bash shell store signal traps between sessions?




  Last Thread   Next Thread Next
  Show Printable Version Email this Page Subscribe to this Thread      Post New Thread    Post A Reply      

    Does the bash shell store signal traps between sessions?  
50295@web.de


View Ip Address Report This Message To A Moderator Edit/Delete Message


 
11-08-05 11:29 PM

Hi -

Before I typed trap "" HUP, all processes started from the bash shell
are termiated with the shell. Now, processes no longer die with the
shell. Are trap commands signal traps between sessions?

Thanks,

- Olumide






[ Post a follow-up to this message ]



    Re: Does the bash shell store signal traps between sessions?  
Michael Tosch


View Ip Address Report This Message To A Moderator Edit/Delete Message


 
11-08-05 11:29 PM

50295@web.de wrote:
> Hi -
>
> Before I typed trap "" HUP, all processes started from the bash shell
> are termiated with the shell. Now, processes no longer die with the
> shell. Are trap commands signal traps between sessions?
>
> Thanks,
>

No, every login session is individual.
Signal definition is gone as soon the bash login shell terminates.


--
Michael Tosch @ hp : com





[ Post a follow-up to this message ]



    Re: Does the bash shell store signal traps between sessions?  
50295@web.de


View Ip Address Report This Message To A Moderator Edit/Delete Message


 
11-08-05 11:29 PM

Michael Tosch wrote:

> No, every login session is individual.
> Signal definition is gone as soon the bash login shell terminates.
>

Thanks. It appears there is a world of difference between terminating
the shell via the close icon (on the upper right corner), and merely
typing exit. Using the latter on a RedHat machine, the (X windows)
application I started did not terminate even though no signal trap was
"installed". I wonder why ...






[ Post a follow-up to this message ]



    Re: Does the bash shell store signal traps between sessions?  
Michael Tosch


View Ip Address Report This Message To A Moderator Edit/Delete Message


 
11-08-05 11:29 PM

50295@web.de wrote:
> Michael Tosch wrote:
>
> 
>
>
> Thanks. It appears there is a world of difference between terminating
> the shell via the close icon (on the upper right corner), and merely
> typing exit. Using the latter on a RedHat machine, the (X windows)
> application I started did not terminate even though no signal trap was
> "installed". I wonder why ...
>

Probably a bug in your X-terminal tool.
Try "xterm" which is based on old but mature code.

--
Michael Tosch @ hp : com





[ Post a follow-up to this message ]



    Re: Does the bash shell store signal traps between sessions?  
50295@web.de


View Ip Address Report This Message To A Moderator Edit/Delete Message


 
11-08-05 11:29 PM

Michael Tosch wrote:

> Probably a bug in your X-terminal tool.
> Try "xterm" which is based on old but mature code.

I'm using bash. You're not suggesting bash 3.00.15(1) is this buggy are
you? ;) . Anyway, same thing happend with xterm. Here's what I did:

- start xterm
- in xterm, run/type: "xcalc &"
- in xterm, run/type: "exit"
--> xcalc continues to run!!!

Is this expected behaviour?






[ Post a follow-up to this message ]



    Re: Does the bash shell store signal traps between sessions?  
Michael Tosch


View Ip Address Report This Message To A Moderator Edit/Delete Message


 
11-08-05 11:29 PM

50295@web.de wrote:
> Michael Tosch wrote:
>
> 
>
>
> I'm using bash. You're not suggesting bash 3.00.15(1) is this buggy are
> you? ;) . Anyway, same thing happend with xterm. Here's what I did:
>
> - start xterm
> - in xterm, run/type: "xcalc &"
> - in xterm, run/type: "exit"
> --> xcalc continues to run!!!
>
> Is this expected behaviour?
>

Yes, this is normal behaviour.
Therefore, your desktop will kill each X-Window separately
when you quit it (logout).

If you want background jobs to be killed at shell exit,
you can do

trap "kill %1" 0
xcalc &

which will kill its first background job.

In bash you can do

trap "jobs -p | xargs kill" 0

which will kill all of its background jobs.


--
Michael Tosch @ hp : com





[ Post a follow-up to this message ]



    Re: Does the bash shell store signal traps between sessions?  
50295@web.de


View Ip Address Report This Message To A Moderator Edit/Delete Message


 
11-17-05 11:13 PM


Michael Tosch wrote:
> 50295@web.de wrote:
 
>
> Yes, this is normal behaviour.
> Therefore, your desktop will kill each X-Window separately
> when you quit it (logout).

I hate to sound like a broken record, but why isn't the HUP signal sent
to xcalc when I exited the shell in the above scenario???






[ Post a follow-up to this message ]



    Re: Does the bash shell store signal traps between sessions?  
Valentin Nechayev


View Ip Address Report This Message To A Moderator Edit/Delete Message


 
11-18-05 12:50 PM


Thu, Nov 17, 2005 at 08:03:59, 50295 (50295@web.de) wrote about "Does the ba
sh shell store signal traps between sessions?":
 
[vbcol=seagreen]
> I hate to sound like a broken record, but why isn't the HUP signal sent
> to xcalc when I exited the shell in the above scenario???

This is shell behavior, not xcalc.
Compare with variant: run xterm, xcalc&, and close xterm by window
manager. xcalc will disappear.
I can't detect now exact mechanism used by bash but ktrace shows
bash calls tcsetpgrp() and setpgid() on exit.


-netch-





[ Post a follow-up to this message ]



    Sponsored Links  




 





   All times are GMT. The time now is 03:21 PM.      Post New Thread    Post A Reply      
  Last Thread   Next Thread Next


Most Popular forums 

Forum Jump:
Rate This Thread:

Forum Rules:
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is OFF
vB code is ON
Smilies are ON
[IMG] code is OFF
 
Medical and Health forum | Computer Games Reviews | Graphics design forum

Back To The Top
Home | Usercp | Faq | Register