Etienne Noël
Etienne Noël

Reputation: 6166

Killing ssh session kills running process

I'm connecting to my ubuntu server using ssh. I start an encoding program using a command. However, it seems that when my ssh session closes (because I started it on a laptop which went to sleep). Is there a way to avoid this (of course preventing my laptop from sleeping is not a permanent solution).

Upvotes: 3

Views: 1061

Answers (3)

janisz
janisz

Reputation: 6371

Run your command with nohup or use screen nohup is better when your program generate some loging output because it's forward to file and then you can check it, but with screen you can detach ssh session and when you log again you can restore your work-space. For encoding I'll use nohup. It is easier and you probably run it in background, so you really don't need detaching

Upvotes: 5

jhcaiced
jhcaiced

Reputation: 716

Install "screen" on your ubuntu server, that way you can start any program in your session, disconnect the output of the program from your current session and exit.

Later when you connect again to your server, you can restore the program which will continue running and see its progress.

Upvotes: 1

Blaskovic
Blaskovic

Reputation: 356

Screen is the best for you.

screen -S some_name

than run it. Detach it with: ctrl+a d

Next time, attach it with:

screen -rd some_name

You can have more runnning screens. To show the list of them:

screen -ls

Upvotes: 3

Related Questions