Possible Duplicate:
How can I capture network traffic of a single process?

I want to write a script which start/resume downloading big file using a download manager say wget only if the browser [say firefox] is not loading anything [actively not using internet].

How can i check from a script whether a process actively using internet or not ?

ss -p will give the connected process but can't say wheter they are active or not

nethogs is a visual solution but i can't use it in script due to its dynamic nature

marked as duplicate by gertvdijk, stephenmyall, Jorge Castro, qbi, ajmitch Jan 24 '13 at 20:22

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

Browse other questions tagged or ask your own question.