Set timeout for web page response with curl

curltimeout

I use a tool to monitor if the web-page is up and running.

The tool uses curl command internally to fetch the output.

However, when a web-page takes longer time to respond, it results back with a TIMEOUT error. There is no way that I can increase the timeout from the tool.

Is there any way to set/modify the timeout period for a response from a web-page?

Is there any variable that can be modified?

Best Answer

You can use -m option:

-m, --max-time <seconds>
              Maximum time in seconds that you allow the  whole  operation  to
              take.   This is useful for preventing your batch jobs from hang‐
              ing for hours due to slow networks or  links  going  down.   See
              also the --connect-timeout option.

              If this option is used several times, the last one will be used.

This includes time to connect, if you want to specify it separately, use --connect-timeout option.

Related Question