Friday, November 10, 2006

Nohup won't stop

I was looking for something like this which seems to adequately do what I want it to.
If you have a Linux PC thats connected to the internet with an SSH server on it, you can do something pretty nifty with it.

How about downloading something using wget while not having anyone connected to the SSH server? I mean if you can't use your pc at that moment to download something, you can go to another one, connect to that Linux PC with SSH, use wget with nohup, close that SSH session and wget will still continue to download and automatically kill itself when done.
This is very convenient and makes sure no one interrupts your downloads by closing your SSH or something. Just don't let anyone shut down the internet connection or the Linux PC.

The only downside is to monitor the progress of the download you have to output it to a file and when you log in you tail the log file to see how far it is. Here is how it works:

After you have connected and logged in do the following:
nohup wget > output.log &

(Note the '&' at the end! Otherwise you have to open up a new console to work on.)
Thats it!

I found this info at:

  • I'm using it right now, it is working correctly and quite nicely. Also if you have a Samba server on it aswell, you can let wget place the file in that directory where Samba has shares and download the file onto your PC when its done (what I'm doing now)!
  • I saw that some people wanted to know how to stop a nohup program. Well it is very simple. Lets say you used wget to download something but you want to stop it, simply type 'killall wget' and that download will stop (just be careful if you have multiple wgets, then all of them will 'die', in that case you have to figure out what that app id is and then type 'kill #app_id_num#'.
  • Also I have recently discovered a faster downloader than wget called ProZilla, click here to read about it.
  • Check this post on "screen". You might find it as a better alternative to nohup.

No comments: