Search code examples
sphinxdelta-index

sphinx delta search indexing and merge in cron job


I had implemented delta indexing in cron job and which is

*/2 * * * * /usr/bin/indexer --config /etc/sphinx/sphinx.conf indexer sph_idx_posts_delta --rotate >  /var/log/cronlog4.log 2>&1

*/3 * * * * /usr/bin/indexer --config /etc/sphinx/sphinx.conf indexer  --merge post sph_idx_posts_delta --rotate  > /var/log/cronlog5.log 2>&1

both are running perfectly when run in putty but give following error in the log file when run in cron job.

Sphinx 2.2.9-id64-release (rel22-r5006)
Copyright (c) 2001-2015, Andrew Aksyonoff
Copyright (c) 2008-2015, Sphinx Technologies Inc (http://sphinxsearch.com)

using config file '/etc/sphinx/sphinx.conf'...
FATAL: there must be 2 indexes to merge specified

I have to do same thing for four more table and all gives me same error. I googled this error and it's saying that create a bash file and than run all code in that file but I am that were also not working, my bash file was not working. any help?


Solution

  • There is redundant part in your commands - indexer, you already specify command in the beginning - /usr/bin/indexer. So, right variant is:

    */2 * * * * /usr/bin/indexer --config /etc/sphinx/sphinx.conf sph_idx_posts_delta --rotate >  /var/log/cronlog4.log 2>&1
    */3 * * * * /usr/bin/indexer --config /etc/sphinx/sphinx.conf --merge post sph_idx_posts_delta --rotate  > /var/log/cronlog5.log 2>&1