开发者

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

  1. GET http://localhost:8080/solr/dataimport?command=full-import

  2. 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

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜