Darshit Shah <[email protected]> writes: >>Can you add a --page-timeout which will >>exit wget after n secs loading a single page? >> > Honestly, I'm unable to see any major use-case for such a > functionality. Why would you want to download a page for only a > constant number of seconds? > > Anyhow, if you do have a valid use case for this, I'd suggest > scripting a solution around Wget. You could invoke Wget in background > mode with -b, sleep() for the amount of time you want and then send a > SIGKILL signal to the Wget process. Killing Wget with SIGKILL will > result in an exit status of 130, which you can use to check if Wget > was indeed downloading a file at the end of the timeout or it had > completed its job and exited, in which case the kill command will exit > with a status of 1.
another option would be to use the "timeout" program from coreutils, it should be available by default on any GNU/Linux distro: $ timeout DURATION wget ...... you can also specify the signal to send to the process. Regards, Giuseppe
