How to tell if a file is being downloaded by wget

lsofwgetzip

I use wget to download files (most are zip files) automatically for me during the night.

However, sometimes in the morning I find that a few files cannot be unzipped. I don't know why this is happening, perhaps it's something wrong with the remote server.

I want to write a script to test zip files in my download folder periodically using 'unzip -t', but I don't want to test on the files that are being downloaded. So how can I tell if a file is being used by wget?

Best Answer

You can use fuser, or lsof.

fuser foo.zip

The output looks like so:

$ fuser archlinux-2013.02.01-dual.iso 
/home/chris/archlinux-2013.02.01-dual.iso: 22506
$ awk -F'\0' '{ print $1 }' /proc/22506/cmdline 
wget
Related Question