As a followup question to this one:

I am downloading a file on multiple remote computers using curl command and am using the --limit-rate parameter to limit the download speed on the ones whose internet is being used:

curl --limit-rate 10k -r 104857601-209715200 -o distro2.iso 'http://files.cdn/distro.iso'

So I have to periodically monitor the internet usage of each computer (like every 5 seconds), and dynamically decrease the --limit-rate once the internet is being used by the user and increase it as the internet usage becomes idle. So the only thing that I need to know is whether the user of remote computer is using their internet (like browsing the web, or downloading a file). Is there any easy way to find out this? I think I have to obtain the PID of curl and exclude it from the list of applications that are using internet to find out whether any other application is using internet. I just don't know which command is better to use. Using commands that do not require sudo privileges are preferred. Any advice would be greatly appreciated!


I once wrote a perl script that ran ifconfig and used the bytes display to figure out the average bandwidth consumed during the poll period (5 seconds or whatever). So, assuming you know what the rate curl is currently running at, you can deduct that speed over the time period (10 k times 5 seconds) and figure out if there is much else going on. Then adjust the speed as needed. I can provide a link to that perl script if you want to try something like that.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.