Beautiful. This was my exact problem, and exact solution.
> Thank you Joe, i added the PATH to the script and it seems to be
> working.
> PJ.
> On Jul 27, 12:51 pm, "Joe Noon" <joen...@gmail.com> wrote:
> > I just ran into this myself. Its most likely that yourcronenvironment
> > isn't the same as your app's user's environment. To fix that, get the PATH
> > of your app's user and set it in the crontab file. Also, set the shell to
> > the same as what you get when you ssh in (mine is bash). Here's an excerpt
> > of mine to show what I mean:
> > PATH=/usr/local/bin:/usr/bin:/bin
> > SHELL=/bin/bash
> > # re-index sphinx every 20 minutes
> > 12,32,52 * * * * cd /var/www/app/current && RAILS_ENV=production rake
> > thinking_sphinx:index >> /dev/null 2>&1
> > Unrelated, but you can set MAILTO the same way.
> > Joe
> > On Sat, Jul 26, 2008 at 7:43 PM, PJAY79 <pjay1...@hotmail.com> wrote:
> > > Hi
> > > I am trying to rebuild the index usingcronand am having trouble with
> > > this. I am using an Ubuntu Gutsy server, with Rails 2.0.2.
> > > I have created a script that would be run undercronevery day. This
> > > is the file, thinkingsphinx.sh (chmod 700):
> > > #!/bin/bash
> > > # script to re-index thinking_sphinx
> > > cd /home/demo/public_html/project/current && /usr/bin/rake
> > > thinking_sphinx:index RAILS_ENV=production
> > > My crontab -e looks like this:
> > > 10 2 * * * /home/demo/rakecron/thinkingsphinx.sh >> /home/demo/
> > > rakecron/cronlogentries.txt 2>&1
> > > When i look at the cronlogentries.txt file, i see this:
> > > (in /home/demo/public_html/project/releases/20080725130346)
> > > indexer --config /home/demo/public_html/project/releases/
> > > 20080725130346/config/production.sphinx.conf --all --rotate
> > > It seems to have run ok, and no errors are seen. But when i look at
> > > the the db/sphinx/production directory and look at the file sizes,
> > > they remain unchanged (i don't know how else to check that the rebuild
> > > has worked???).
> > > If if run the script manually from the command line using:
> > > ./thinkingsphinx.sh
> > > The index appears to have rebuilt (again, i just look at the files
> > > sizes in the db/sphinx/production directory), so the script does work.
> > > So the problem is that this does not appear to be working when it is
> > > run throughcron!
> > > Any help appreciated...
> > > PJ.