5

I have a RaspberryPi. I want to download a big file with wget but the problem is that once I log into the Pi and use wget to download the file, it will abort the download when I close the session.

How can I force wget to continue the download after the session is terminated?

jasonwryan
  • 73,126

3 Answers3

4

Maybe you should have a look at screen

  1. Connect to the RaspberryPi via ssh
  2. Create new screen session screen -S mySession
  3. Start wget wget http://example.org/file.big
  4. Detach Screen Session strg+a strg+d

Now you can exit from the ssh-session. After some time you want to check if the download has finished. On the RaspberryPi simply do screen -r to re-attach the screen session

https://wiki.archlinux.org/index.php/GNU_Screen

xx4h
  • 2,400
2

I was able to continue to download with the flag --http-keep-alive.

jasonwryan
  • 73,126
2

You can run wget in the background like so:

wget link & disown

The wget process will continue to run in the background, even if you close the terminal or log out of the remote machine.

Another way would be to use byobu. This is very similar to the method xx4h proposed (byobu even uses screen sometimes), but I consider it easier.

Install byobu. This will depend on what Linux distribution you are running on your Pi. If it's Raspbian you should be able to use:

sudo apt-get install byobu  

I'm not familiar with Arch, but if you are running Arch I'm guessing you should know how to install it.

Then run:

byobu  

Start your wget process and press F6. You can now log out of the remote machine. When you come back, running byobu again will connect to the session you started earlier with your wget process.

Seth
  • 1,631