Skip to content

Commit

Permalink
replaced pinging script
Browse files Browse the repository at this point in the history
  • Loading branch information
mausch committed May 29, 2010
1 parent 1f3c815 commit 7b2c8af
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 3 deletions.
28 changes: 28 additions & 0 deletions pingsolr.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
function ping(url) {
var request = new ActiveXObject('MSXML2.XMLHTTP.3.0');
request.open('GET', url, false);
try {
request.send();
return request.status == 200;
} catch (e) {
return false;
}
}
function pingUntilOK(url) {
for (var i = 0; i < 10; i++)
if (ping(url))
return true;
return false;
}
WScript.Echo('Waiting for Solr to start up...');
if (!pingUntilOK('http://localhost:8983/solr')) {
WScript.Echo('Solr did not start up successfully. Please see the log.');
WScript.Quit(1);
}

WScript.Echo('Waiting for web app to start up...');
if (!pingUntilOK('http://localhost:8082')) {
WScript.Echo('Web app did not start up successfully. Please see the log.');
WScript.Quit(1);
}
WScript.Quit(0);
4 changes: 1 addition & 3 deletions runsample.bat
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@ md logs
start java -jar start.jar
cd ..
start tools\cassini\cassini.exe "%cd%\SampleSolrApp" 8082
ping 127.0.0.1 -n 2 -w 2000 > nul
tools\curl -I -m5 http://localhost:8983/solr >nul
tools\curl -I -m5 http://localhost:8082 >nul
cscript /nologo pingsolr.js
start http://localhost:8082/
exit
Binary file removed tools/curl.exe
Binary file not shown.

0 comments on commit 7b2c8af

Please sign in to comment.