views:

1217

answers:

2

I'm running a PHP script via cron using Wget, with the following command:

wget -O - -q -t 1 http://www.example.com/cron/run

The script will take a maximum of 5-6 minutes to do its processing. Will WGet wait for it and give it all the time it needs, or will it time out?

+1  A: 

I think the default timeout is 900 second read timeout.

wget will also try for a few times (not sure how many) till it times out every try.

I think you can skim through the wget man document.

hIpPy
+1  A: 

According to the man page of wget, there are a couple of options related to timeouts -- so I say that, yes, it could timeout.


Here are the options in question :

-T seconds
--timeout=seconds

Set the network timeout to seconds seconds. This is equivalent to specifying --dns-timeout, --connect-timeout, and --read-timeout, all at the same time.


And for those three options :

--dns-timeout=seconds

Set the DNS lookup timeout to seconds seconds.
DNS lookups that don't complete within the specified time will fail.
By default, there is no timeout on DNS lookups, other than that implemented by system libraries.

--connect-timeout=seconds

Set the connect timeout to seconds seconds.
TCP connections that take longer to establish will be aborted.
By default, there is no connect timeout, other than that implemented by system libraries.

--read-timeout=seconds

Set the read (and write) timeout to seconds seconds.
The "time" of this timeout refers to idle time: if, at any point in the download, no data is received for more than the specified number of seconds, reading fails and the download is restarted.
This option does not directly affect the duration of the entire download.


I suppose using something like

wget -O - -q -t 1 --timeout=600 http://www.example.com/cron/run

should make sure there is no timeout before longer than the duration of your script.

(Yeah, that's probably the most brutal solution possible ^^ )

Pascal MARTIN
if i set -t 0 will it wait indefinitely?
Click Upvote
The `-t` option seems to be an alias of `--tries`, which *Set number of retries to number.* ;;; It doesn't seem to relate to any kind of timeout, but to the number of times wget will re-try to download if there is an error -- and you probably don't want a timeout be considered as an error, and the script being re-called.
Pascal MARTIN
cheers ..................:)
Click Upvote