timeout and curl

I’m trying to make an app that monitors to see if our server for our digital archives is mounted. (It keeps disconnecting for some reason).

I thought this would be an easy way to tell:

set errorList to {}
try
	with timeout of 6 seconds
		set imagearchivecheck to do shell script "curl [url=http://macapache2.xxxxxxx.com/mia2/index.php]http://macapache2.xxxxxxx.com/mia2/index.php"[/url]
	end timeout
on error errMsg
	copy {"Image Archive", errMsg} to end of errorList
end try

but the timeout doesn’t seem to work, after six seconds the script just chugs along, does the curl call over ride the timeout?

with timeout Statements

Try something like this:

set errorList to {}
try
	do shell script "/usr/bin/curl --silent --show-error --max-time 6 'http://twitter.com/'"
on error errMsg
	set end of errorList to {"Image Archive", errMsg}
end try

Hi,

curl has its own connection timeout parameter

–connect-timeout
Maximum time in seconds that you allow the connection to the
server to take. This only limits the connection phase, once
curl has connected this option is of no more use. See also the
-m/–max-time option.