[plug] Can I restart a suspended job on a remote machine from a different shell?
Bernard Blackham
bernard at blackham.com.au
Fri Mar 18 16:21:18 WST 2005
On Fri, Mar 18, 2005 at 03:46:56PM +0800, Russell Steicke wrote:
> On Fri, Mar 18, 2005 at 03:16:07PM +0800, W.Kenworthy wrote:
> > I should have made it clearer - the job is suspended in a running
> > terminal on the remote machine itself so the file descriptors etc are
> > still there. I am hoping that the shell can be sent a signal by another
> > process to restart this job. Otherwise when I get home I'll just "fg"
> > it and it will start running again.
>
> You could try sending the job a SIGCONT. You will probably have to
> work out exactly which processes are stopped (the T status in ps).
> "kill -CONT pid", anyway. Job control can suspend more than one
> process in the job, I think.
>
> I just tried exactly that here, by sending a SIGCONT to a suspended
> "ls -al" from a different xterm, and it worked.
The only problem with this is that either the shell will get a
little confused, as it'll still be the shell marked as the
controlling process of the tty (the shell won't be aware the the
process is now foregrounded), or the process will try to write to
standard output, find out it's not the controlling process of the
tty, and be sent a SIGTTOU and stop.
If you're daring, you could try an experimental tty stealer that I
wrote a while back - http://dagobah.ucc.asn.au/things/grab.c - it
lets you catch the ttys of a currently running process to your
current tty (for example, into a screen) ... I've been meaning to
improve it never got around to it.
Bernard.
--
Bernard Blackham <bernard at blackham dot com dot au>
More information about the plug
mailing list