LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   background programs (https://www.linuxquestions.org/questions/linux-newbie-8/background-programs-250508/)

comp_brad1136 11-03-2004 02:36 AM

background programs
 
I need to do a LOT of compiling on a slow machine. The machine is accessale via ssh.

What I would like to do is:

login to the machine via SSH
start a compile ( that will in some cases take in excess of 24 hours )
be able to end the SSH session, and the process will still continue
have the compile continue running, while not logged in
at any time, ssh back in to check on things

Basically, I want to ssh in, start something that will take an indefinate amount of time in the morning, check in on it at work (interact if necessary), come home at the end of the day, terminal in to start a new job, go to bed, wake up in the morning, and start the cycle again.

What are some of the options that I have in doing this? It seems that if I issue
"make foo &"

and then logout, "make foo" gets killed. I need that ability to log out, and have "make foo" continue running.

shy 11-03-2004 02:44 AM

Maybe the screen program is what you need. It has many useful things, and the first one is the ability to run many text 'screens' in one terminal session. But is't ability to run in the background in "detached" state, and the possibility to "reattach" to the previously detached session (showing you all the output of programs which could be run there) can be what you need.

EyesOnly 11-03-2004 02:45 AM

'screen' seems to be the command you need.

when starting screen, you get a 'virtual-terminal'. You can then detach this terminal, and log off off ssh.
The programs you launched in 'screen' will keep on running.
You can then later re-attach the screen-session, and continue.

Here is a little link which might help a bit. You propably already have screen installed by default



http://www.linuxforum.com/shell/screen/134-35.php

edit:
woops.. shy was a little faster than me:D

shy 11-03-2004 02:56 AM

Quote:

Originally posted by EyesOnly
woops.. shy was a little faster than me:D
Sorry, I hope you don't mind :)

EyesOnly 11-03-2004 05:36 AM

Quote:

Originally posted by shy
Sorry, I hope you don't mind :)
'course not:p

comp_brad1136 11-03-2004 11:51 AM

screen
 
thank you for the suggestions. I'll RTFM for screen.

shengchieh 11-03-2004 05:45 PM

Any program can be run in background using &.
You can also use the sleep command. So you
can start a script on that machine instead of
remotely starting. E.g. create the file, runprogram.scr

as

#/bin/sh
sleep <seconds>
<your program compiling>

and on a console

chmod +x runprogram.scr (first time: change permission)
runprogram.scr &

How to incorporate screen - I don't know - others might know

Sheng-Chieh


All times are GMT -5. The time now is 02:28 PM.