Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
Put a running build in the background
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Other Things Gentoo
View previous topic :: View next topic  
Author Message
l_bratch
Guru
Guru


Joined: 08 Feb 2005
Posts: 494
Location: Jersey

PostPosted: Sun Mar 20, 2005 10:15 am    Post subject: Put a running build in the background Reply with quote

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
View user's profile Send private message
Enforcer
n00b
n00b


Joined: 07 Oct 2004
Posts: 9
Location: Duisburg, NRW, Germany

PostPosted: Sun Mar 20, 2005 10:23 am    Post subject: Reply with quote

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
View user's profile Send private message
BlackEdder
Advocate
Advocate


Joined: 26 Apr 2004
Posts: 2588
Location: Dutch enclave in Egham, UK

PostPosted: Sun Mar 20, 2005 11:02 am    Post subject: Reply with quote

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:
Code:
ctrl+z
nohup %1
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
View user's profile Send private message
l_bratch
Guru
Guru


Joined: 08 Feb 2005
Posts: 494
Location: Jersey

PostPosted: Sun Mar 20, 2005 9:31 pm    Post subject: Reply with quote

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
View user's profile Send private message
BlackEdder
Advocate
Advocate


Joined: 26 Apr 2004
Posts: 2588
Location: Dutch enclave in Egham, UK

PostPosted: Sun Mar 20, 2005 9:34 pm    Post subject: Reply with quote

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
View user's profile Send private message
l_bratch
Guru
Guru


Joined: 08 Feb 2005
Posts: 494
Location: Jersey

PostPosted: Mon Mar 21, 2005 9:57 am    Post subject: Reply with quote

Ok thanks for trying, at least I now know about the screen method for future referance.
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Other Things Gentoo All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum