Larry Price wrote,
>I've been trying to figure it out and given my relatively basic
>understanding of the *nix process model it seems like it _ought_ to be
>possible.
>
>i've read thru the man pages for getty, the info documentation on nohup,
>tty and even the man page on termios.
>
>1. Is there a command that does this?
>
>2. Is this even a possible, i understand that a command that could do
> this would be a security risk and you'd definitely want it to
> check if the UID of it's caller matched the owner of the process
> you were trying to connect to and that it was connecting to a
> process that was no longer talking to the outside world.
> But is there a more basic reason why this would not be possible?
>
>Motivation:
>efn's 2 hr. connect policy sometimes has me logging back in and kill -9ing
>the emacs that i was just using a thing that always makes me feel stupid
>and as if there were a better way of doing it.
Short answer: No, there's no command that does that. Once a session crashes
and leaves something running, there's generally no way back, and the only way
to recover is to kill the leftover process. I usually find that killing
the leftover login shell (if it's still there) is the best way to go, since
it usually takes its children with it when it dies.
Longer answer: Yes, there is a command that can do that, but only if you
prepare for it in advance. To prepare for it in advance, you'll need a
program called "screen"...it's not part of most UNIX distributions, but
it's a GNU program, and can be obtained from the usual GNU download places.
When you run "screen", it starts up a new shell, running under a new TTY
under the control of the "screen" program. You can then run other programs
normally under this sub-shell.
Here's the part you'll be interested in: when you press "control-A" and
then "d", "screen" will exit back to your original login shell, but leave
your sub-shell still running in the background, under the control of a
"screen daemon". At this point you can log off completely, and your
sub-shell will still be there. When you log in again, type "screen -r" to
reconnect to the sub-shell, and you can resume your work just as if you had
never logged off at all.
When you're through using the sub-shell, type "exit". "Screen" will
terminate when its last sub-shell exits.
"Screen" has other neat features as well, such as the ability to support
multiple virtual terminals and cutting and pasting (without a mouse!) even
if you're not logged in at the console.
- Neil Parker, [EMAIL PROTECTED]