[vox-tech] Crontab oddity - server timeout?

Tony Cratz cratz at hematite.com
Mon Mar 23 15:39:18 PDT 2009


Bill Kendrick wrote:
>   STATUS=`wget --save-headers http://www.MYSITE.com/ -O - 2> /dev/null | head -1 | cut -d " " -f 2`
> 
> In other words, hit the site, save the headers, save them out to stdout,
> chop off the "HTTP/1.1" to get the delicious "200" (hopefully) status.
> 
> 
> I guess maybe I need to give it a "--timeout" argument, and something
> less than 120 seconds, so that the jobs don't run over each other...?


	Why not do something like:

STATUS=`wget -T 120 --save-header http://www.MYSITE.com/ -0 -2>
/dev/null | grep "^HTTP/1.1 200 OK"`

	If STATUS is "" it failed otherwise it passes. Buy using the
	grep you reduce running the extra pipe and it is clearer to
	understand by someone else as to what you are looking for.

								Tony


More information about the vox-tech mailing list