Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Quitting ssh -X session with a running GUI program but leaving the program to run on the remote host

I have ssh-ed to a remote machine. I have enabled X11 forwarding (ssh -X) and I have started a GUI program.

The program takes 5 minutes to set up to do some processing but the actual processing takes 1-2 hours. I don't want to stream data while the program is working. I don't even want to see the program again as it produces files as output when it finishes and I can just scp them.

So how can I quit the ssh session but leave the program running on the machine? CRTL+C in the terminal?

EDIT: For the answer please see my comment just below.

like image 296
s5s Avatar asked Mar 05 '12 19:03

s5s


2 Answers

Long story short - you can't do this without making some modifications to the way you run things. A GUI application requires for an X server target to be accepting it's GUI updates - if you're using your local X server to do this, then it'll require (1) the connection to be open (2) that you actually handle the updates.

A way around this is to use something like Xvfb - which is a headless way of hosting a virtual X-server. Above and beyond the examples provided on the wikipedia page, folks who seem to make frequent use of this mechanism are Selenium users.

like image 151
synthesizerpatel Avatar answered Nov 15 '22 21:11

synthesizerpatel


Awesome, I've been looking for an acceptable answer to my problem for hours, and finally one pops up. ssh -X -f login@machine yourprogram worked perfectly for me. Though I used ssh -Y -f login@machine yourprogram. This has been driving me nuts.

like image 39
user223416 Avatar answered Nov 15 '22 19:11

user223416