To reduce the impact on your scripts or other use, you can set the maximum time in seconds which curl will allow for the connection attempt. With --connect-timeout
you tell curl the maximum time to allow for connecting, and if curl has not connected in that time it returns a failure.