rvm + cron + thinking_sphinx
- Want to change crontab’s editor?
export EDITOR=vim |
- crontab -e
PATH=/sbin:/bin:/usr/sbin:/usr/bin 30 * * * * /home/rupert/bin/rvm-shell 'ruby-1.9.2-p180@travelspotsinasia' -c 'RAILS_ENV=production rake -f /srv/rails/travelspotsinasia/Rakefile thinking_sphinx:rebuild' > $HOME/travelspotsinasia.index.log |
- Didn’t work the first time. Argh.
robin:~% mail Heirloom mailx version 12.4 7/29/08. Type ? for help. "/var/mail/rupert": 2 messages >O 1 Cron Daemon Mon Aug 22 21:08 32/1314 Cron <rupert@robin> /home/rupert/bin/rvm-shell 'ruby-1.9.2-p180@travelspotsinasia' -c 'RAILS_ENV=producti Sphinx cannot be found on your system. You may need to configure the following settings in your config/sphinx.yml file: * bin_path * searchd_binary_name * indexer_binary_name </mail> |
- Quick fix
% cd /usr/bin % sudo ln -s /usr/local/sphinx/bin/indexer indexer % sudo ln -s /usr/local/sphinx/bin/indextool indextool % sudo ln -s /usr/local/sphinx/bin/search search % sudo ln -s /usr/local/sphinx/bin/searchd searchd % sudo ln -s /usr/local/sphinx/bin/spelldump spelldump |
- Test by adjusting the date on cron. Wait for cron to kick in. Check the log file.
Awesome.
robin:~% tail -f travelspotsinasia.index.log (in /home/rupert) Stopped search daemon (pid 16831). Generating Configuration to /srv/rails/travelspotsinasia/config/production.sphinx.conf Sphinx 0.9.9-release (r2117) Copyright (c) 2001-2009, Andrew Aksyonoff using config file '/srv/rails/travelspotsinasia/config/production.sphinx.conf'... indexing index 'poi_core'... collected 10700 docs, 1.1 MB sorted 0.2 Mhits, 100.0% done total 10700 docs, 1106049 bytes total 0.363 sec, 3042131 bytes/sec, 29429.80 docs/sec distributed index 'poi' can not be directly indexed; skipping. total 2 reads, 0.001 sec, 592.8 kb/call avg, 0.8 msec/call avg total 7 writes, 0.005 sec, 393.1 kb/call avg, 0.7 msec/call avg Started successfully (pid 17764). |