Start from this point:
http://wiki.apache.org/solr/DataImportHandler
So, you can try to use this script:
#!/bin/bash
wgetProgram=wget
urlCmd='http://localhost:8080/solr/mycore/dataimport?command=delta-import&clean=false'
statusCmd='http://localhost:8080/solr/mycore/dataimport?command=status'
outputDir=.
$wgetProgram -O $outputDir/check_status_update_index.txt ${statusCmd}
2>/dev/null
status=`fgrep idle $outputDir/check_status_update_index.txt`
if [[ ${status} == *idle* ]]
then
$wgetProgram -O $outputDir/status_update_index.txt ${urlCmd}
2>/dev/null
fi
save it somewhere (ex. /root/script_solr) like "update-solr.sh" and
chmod +x.....
Now you can config it from root user in crontab:
linux:~# crontab -e
and insert for run every 2 minutes:
*/2 * * * * cd /root/script_solr && /root/script_solr/update-solr.sh
On 27/06/11 09:01, Romi wrote:
Thanks for answering but i don't know how to write script for fetching data
from database and index it in to solr and how to setup this script as
cron-job to run automatically at certain interval.
Please suggest
--
Renato Eschini
Inera srl
Via Mazzini 138
56100 Pisa (PI)
Tel: (+39) (0)50 9911800
Fax: (+39) (0)50 9911830
Int: (+39) (0)50 9911819
Email: r.esch...@inera.it
Msn: r_esch...@hotmail.com
Skype: renato.eschini
WWW: http://www.inera.it
Rispetta l'ambiente - รจ veramente necessario stampare questa e-mail?
Please consider the environment - do you really need to print this e-mail?