Web Hosting Talk







View Full Version : Shell jobs - continue running when shell closed?


MattF
06-25-2002, 07:15 PM
How do I make a shell job continue running when I close my shell session or disconnect from the net.

Say I log in as 'root' remotely using SecureCRT and start using wget to retreive a 10gb file, or or execute any other command that takes a lot of time and doesn't require user input.

If I get disconnected from the net, or close SecureCRT accidentally or not, the server terminates the job.

I've tried putting the jobs into the background, which gives me the prompt back, however when the shell is closed the job also terminates.

anyway around this?

The Prohacker
06-25-2002, 07:19 PM
man screen
:D

The Prohacker
06-25-2002, 07:30 PM
To make a screen:

screen -A -m -d screename command


To get to a screen:

screen -r screename

weeps
06-25-2002, 07:42 PM
I'm not sure if this will stop if you get disconnected.. but.. to run a process in the background you could go like 'wget http://www.x.com/x.zip&' where the '&' makes it run in the background by putting it at the end of the statement.

clocker1996
06-25-2002, 07:49 PM
no

wget domain.com/file.txt -b

-b = backround

or you could try

>/dev/null&
after your command

The Prohacker
06-25-2002, 07:52 PM
There are many ways to launch programs into the background and they are almost all right :D

Noldar
06-25-2002, 08:03 PM
nohup wget bigfile.tar

Richard

ffeingol
06-25-2002, 08:05 PM
nohup command &

nohup will set the command (or script) so it won't terminate on a "hangup". The output (by default) will go to nohup.out.

man nohup for more details.

Frank