![]() |
|
|
|
|
|||||||
| Forums | Portal | Register | Rules & FAQ | Contribute | Members List | Arcade | 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 here. |
|
|
||||
| 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 05:40 AM |
| Leaving Program running but killing the script | deaconf19 | Shell Programming and Scripting | 2 | 11-15-2007 10:17 PM |
| Getting value of variable set in subprocess script | hadarot | Shell Programming and Scripting | 1 | 08-11-2005 11:41 PM |
| check if job still alive and killing it after a certain walltime | ciwstevie | Shell Programming and Scripting | 3 | 07-27-2005 04:04 AM |
| Multiple FTP scripts submitted to a subprocess | tomstone_98 | UNIX for Advanced & Expert Users | 0 | 02-11-2005 07:11 AM |
|
|
LinkBack | Thread Tools | 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 |
|||
| Google UNIX.COM |
| Forum Sponsor | ||
|
|