Start solr-DataImport via linux shell (cron)?
Currently im running solr 3.1 on a tomcat 6 on a ubuntu 10.04 machine. Everything works, i can start indexing from my mysql-database via http://localhost:8080/solr/dataimport?command=full-import which returns some data about the indexing process.
Now i want to trigger a redindex/update via cron, so it would be nice to do it via "java -jar ..." and not cia curl. At best the program would run as long as the reindex/update takes and return the stats if finished, so my shell script will wait for 开发者_StackOverflowthe update to finish. Is this archivable ?
Well you can achieve that by using a simple script that has following steps
GET http://localhost:8080/solr/dataimport?command=full-import
while True
2.1 GET http://localhost:8080/solr/dataimport?command=status INTO status.xml
2.2 PARSE status.xml to check for indexing completed
2.3 IF completed break
2.4 ELSE SLEEP 1
精彩评论