Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Does quitting putty close the running command

I was using rsync to copy 15GB files between servers using putty. I want to know that if i close putty terminal does that also termiates rync or not because file is not copied properly.

I have tried that when i am doing backups then even if i close putty then scrip continue to run in background

like image 925
Mahakaal Avatar asked May 16 '11 01:05

Mahakaal


People also ask

How do I save and exit PuTTY?

Press the i button from the keyboard to start the editing. Press the Esc button to stop the editing. Type :wq! to Save the file & Close the editing window.


2 Answers

Assuming your goal is to have the rsync command continue to run, the simplest thing is to orphan the job. There are two ways to do this:

(rsync foo bar &)

The above will create the job detached from your terminal in the beginning, so closing the terminal will not stop it.

rsync foo bar & # or without &, then Ctrl-Z to stop, then "bg" to background
disown

The above will disown a running job, so you can close the terminal without stopping it.

Finally, you could use the program screen(1) or similar to keep a terminal session alive and intact (and able to be resumed) even when you end your Putty session.

like image 161
John Zwinck Avatar answered Oct 16 '22 14:10

John Zwinck


Generally most command will quit if the console is closed. If you want them to keep running look at the NOHUP command (Nohup is No Hang Up Process, a hang over from the days of modems and 'hanging up' the phone)

like image 34
Karl Avatar answered Oct 16 '22 14:10

Karl