View previous topic :: View next topic |
Author |
Message |
fusama n00b
Joined: 31 Aug 2005 Posts: 21 Location: USA
|
Posted: Tue Aug 12, 2008 7:22 pm Post subject: how to dissassociate proccess with the shell? |
|
|
Here's what I want to do. I want to ssh (via putty) into my gentoo box and start some long-running job, say "emerge kde-meta" and then close putty and have the job keep running (until it completes, obviously).
I have found no combination of &, nohup, disown, or disown -h that would do this. (I was using bash if it matters) The best I did was that one combination (sorry, don't remember which one) that would get the job to not die when putty closed, but it stopped executing, which doesn't do me much good. (I was using a second ssh connection (via putty) to watch what was going on when I closed the first ssh session). With all other combinations I tried the process died when putty closed.
It seems like this is something that should be possible, but I'm at a loss as to how to do it.
Thanks. |
|
Back to top |
|
|
timeBandit Bodhisattva
Joined: 31 Dec 2004 Posts: 2719 Location: here, there or in transit
|
Posted: Tue Aug 12, 2008 7:28 pm Post subject: |
|
|
nohup command & does this. The process will block if it needs any input however (e.g., emerge -a would be bad).
Another, far more flexible option: app-misc/screen. _________________ Plants are pithy, brooks tend to babble--I'm content to lie between them.
Super-short f.g.o checklist: Search first, strip comments, mark solved, help others. |
|
Back to top |
|
|
termite Guru
Joined: 06 May 2007 Posts: 466
|
Posted: Tue Aug 12, 2008 9:02 pm Post subject: |
|
|
emerge screen, then run something like Code: | screen -S myprocess | It will open a shell, in which you can start whatever you like. When you're ready to disconnect, press Ctrl-a, then d. If you want to reconnect to the process, run Code: | screen -r myprocess | Screen can do a lot more than that, but that will get you started. |
|
Back to top |
|
|
beandog Bodhisattva
Joined: 04 May 2003 Posts: 2072 Location: /usa/utah
|
Posted: Tue Aug 12, 2008 9:24 pm Post subject: |
|
|
you don't have to name the session if you want, anyway.
just do screen, then detach it. then screen -r or screen -x to retach it, using the session name if there's more than one.
anyway, like everyone has said ... lots of ways to use screen. ++ _________________ If it ain't broke, tweak it. dvds | blurays | blog | wiki |
|
Back to top |
|
|
Mad Merlin Veteran
Joined: 09 May 2005 Posts: 1155
|
|
Back to top |
|
|
ddriver n00b
Joined: 24 Feb 2005 Posts: 67
|
Posted: Wed Aug 13, 2008 9:45 am Post subject: |
|
|
Another way is to run the command using "batch". batch is just an alias for "at now". |
|
Back to top |
|
|
|