View previous topic :: View next topic |
Author |
Message |
l_bratch Guru
Joined: 08 Feb 2005 Posts: 494 Location: Jersey
|
Posted: Sun Mar 20, 2005 10:15 am Post subject: Put a running build in the background |
|
|
Say I kicked off an emerge of something huge like xorg-x11 on another machine over an ssh session, but needed to logoff the machine I was sitting at, how would I tell the sshd machine (doing the emerging) to put the emerge into the background (similar to as if I had launched it with emerge xorg-x11 &) so that I could log out of ssh but leave the emerging running? If such a thing is possible I assume I'd need to create a new ssh session into the emerging machine, but then what? |
|
Back to top |
|
|
Enforcer n00b
Joined: 07 Oct 2004 Posts: 9 Location: Duisburg, NRW, Germany
|
Posted: Sun Mar 20, 2005 10:23 am Post subject: |
|
|
You can use screen to do so. After you logged in over ssh execute screen and use it like a normal terminal. To detach the terminal type Ctrl+A+D, to reattach it (after you logged in again) type screen -R.
So long,
Enforcer |
|
Back to top |
|
|
BlackEdder Advocate
Joined: 26 Apr 2004 Posts: 2588 Location: Dutch enclave in Egham, UK
|
Posted: Sun Mar 20, 2005 11:02 am Post subject: |
|
|
BTW emerge xorg-x11 & will still be stopped when you disconnect from ssh. You need nohup to do that. Code: | nohup emerge xorg-x11 |
If you want to do this with an already running program do: Ctrl+z will pause the job, then you can resume that job with %<jobnumber> (I assumed it was the job number was 1 in this example).
In general though screen is a better altrernative. Especially because you can reattached it again and look how it's doing. |
|
Back to top |
|
|
l_bratch Guru
Joined: 08 Feb 2005 Posts: 494 Location: Jersey
|
Posted: Sun Mar 20, 2005 9:31 pm Post subject: |
|
|
Thanks both of you - it looks like in future I'll use screen.
But for the example of an already running process, with the ctrl+z then nohup %1, I get:
Quote: | bash-2.05b# nohup %1
nohup: appending output to `nohup.out'
nohup: cannot run command `%1': No such file or directory
bash-2.05b# |
|
|
Back to top |
|
|
BlackEdder Advocate
Joined: 26 Apr 2004 Posts: 2588 Location: Dutch enclave in Egham, UK
|
Posted: Sun Mar 20, 2005 9:34 pm Post subject: |
|
|
You are right. I guessed that it would work like that, but apparently not Then I don't think you can detach already running processes |
|
Back to top |
|
|
l_bratch Guru
Joined: 08 Feb 2005 Posts: 494 Location: Jersey
|
Posted: Mon Mar 21, 2005 9:57 am Post subject: |
|
|
Ok thanks for trying, at least I now know about the screen method for future referance. |
|
Back to top |
|
|
|