Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Say, I'm downloading a file using wget on the server machine via SSH and due to some internet connectivity issues, ssh kicks me out saying broken pipe. What happens to the wget download? Would it stop or would it continue? If it were to continue, how do you get back to see the download process?

share|improve this question

migrated from stackoverflow.com Jul 13 '12 at 11:55

This question came from our site for professional and enthusiast programmers.

1  
isn't this easy to test, by killing your ssh-wget session from 2nd session? –  tuxuday Jul 13 '12 at 11:30
2  
keywords: tmux, screen or nohup, disown –  J.F. Sebastian Jul 13 '12 at 11:33
    
I'm sorry but how do I do that? Having logged back in, it shows nothing –  Aditya Vikram Thoomati Jul 13 '12 at 11:33
    
you can if wget is running . Also you can check wget -C to see if downloading resumes in case if wget does get killed. –  Aftnix Jul 13 '12 at 11:42
    
internet connectivity issues like pulling a cable out (hint) –  barlop Dec 2 '12 at 13:15
add comment

2 Answers

Assuming this is what you mean:

  1. You are connected to a remote machine by SSH.
  2. You start a download using wget.
  3. Your SSH connection breaks somehow, but the remote machine is well connected to the server it is downloading from.

In such scenario, most of the times wget continues to run. You can verify this by monitoring file size of the file being downloaded periodically from another computer. Moreover, if you reconnect to the remote machine via new SSH session, you can wget -c on same file. This will result into two wget instances downloading the same file - not good. In essence, old instance of wget will keep running until the download is finished or you explicitly kill it by running killall wget from the new SSH session.

share|improve this answer
add comment

It will already have received all of the data it can bar maybe a few packets that are still in transit in odd circumstances. You shouldn't receive any further data from the server.

Wget does support resuming downloads though this is dependent on the remote server accepting a restart which not all will, especially for SSL since the encryption makes the task more complex.

As @Aftnix has suggested, try re-running the command with -C to see if you can resume the download.

It may also be that the request failed early on? In that case, perhaps nothing useful was retrieved by the broken request.

UPDATE: Ah, I've just realised that it was SSH you got kicked out of! Not the wget command! The results of this are pretty much the same though. The remote wget command would have been terminated from memory as soon as the SSH connection broke. If wget retrieved anything useful, it will be in the folder you ran the command from unless you redirected the output to somewhere else.

When working on unreliable SSH links, you should generally use screen so that the termination of the link doesn't break your commands.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.