![]() |
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.
|
|
google unix.com
|
|||||||
| Forums | Register | Forum Rules | Links | Albums | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here. |
More UNIX and Linux Forum Topics You Might Find Helpful
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| How to wait for the subprocess to finish in tcl | nathgopi214 | Shell Programming and Scripting | 1 | 03-26-2008 09:40 AM |
| Leaving Program running but killing the script | deaconf19 | Shell Programming and Scripting | 2 | 11-16-2007 02:17 AM |
| Getting value of variable set in subprocess script | hadarot | Shell Programming and Scripting | 1 | 08-12-2005 03:41 AM |
| check if job still alive and killing it after a certain walltime | ciwstevie | Shell Programming and Scripting | 3 | 07-27-2005 08:04 AM |
| Multiple FTP scripts submitted to a subprocess | tomstone_98 | UNIX for Advanced & Expert Users | 0 | 02-11-2005 11:11 AM |
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
||||
|
Killing an Xterm while leaving subprocess alive...
Hi,
I'm not quite understanding what I'm doing (happens often). This pseudocode works: #!/bin/pseudoksh function kill_parent { when i_want_to ; do sleep 2 kill -TERM $PPID exit done } kill_parent & ssh remote_host sh <<-EOF notify_kill_parent # let the bg function know it's ok to kill parent run_command # something x-based EOF Now, if I start my script in an xterm: xterm -e run_my_script It works as expected! The xterm pops up, ssh queries me for a password, the command runs and displays, and, seconds later, the xterm is killed. This is what I want to have happen. But I'm not sure why the remote shell and my application (run_command, above) still stick around. I've been pretty sloppy with stdin/stdout so I'm surprised they don't disappear when I kill the parent (xterm). I'm happy it works, but I'm worried about a bug creeping in later- for example, since I'm not handling stdout, am I in danger of filling a buffer that is going to make the app hang? Or something like this. I'm looking for insight into what happens when xterm calls ssh which calls a shell which calls a command. Xterm dies but the command does not. Why? Thanks. -Schwage |
![]() |
| Bookmarks |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|