Re: Restart thinking_sphinx after server reboot

83 views
Skip to first unread message
Message has been deleted

Morten

unread,
Aug 16, 2008, 8:54:39 AM8/16/08
to Thinking Sphinx

> When i have to reboot my production server, i would like
> thinking_sphinx to restart automatically as well. Is there a way to do
> this through a cron job?

Look for @reboot here http://mkaz.com/ref/unix_cron.html

@rebot cd /my/path ; RAILS_ENV=production rake ts:in >> /some/log.log
2>&1 && RAILS_ENV=production rake ts:start >> /some/log.log 2>&1

As far as I know, rake ts:in implies rake ts:config

Br,

Morten

James Healy

unread,
Aug 17, 2008, 1:16:02 AM8/17/08
to thinkin...@googlegroups.com
PJAY79 wrote:
> When i have to reboot my production server, i would like
> thinking_sphinx to restart automatically as well. Is there a way to do
> this through a cron job?

It depends a bit on what OS you're running. On Debian (and many other
linux systems) the preferred way is to place a script in /etc/init.d that
can start/stop the daemon.

I've been meaning to write one for sphinx for some time for our
production server. I'll try and do it over the next few days and post a
copy to the list.

-- James Healy <jimmy-at-deefa-dot-com> Sun, 17 Aug 2008 15:14:12 +1000

Message has been deleted

James Healy

unread,
Aug 17, 2008, 7:38:35 AM8/17/08
to thinkin...@googlegroups.com
PJAY79 wrote:
> However, delta indexes have stopped working after a reboot. So any new
> entries to the database are returning nil search results. Why would
> this be happening...??? This is odd...

What user is the sphinx daemon running as after reboot? If it's running
as root, and your mongrels as something else (like they should be), then
it's possible they won't have permission to update the index files.

-- James Healy <jimmy-at-deefa-dot-com> Sun, 17 Aug 2008 21:37:25 +1000

Message has been deleted

Pat Allan

unread,
Aug 18, 2008, 6:49:49 PM8/18/08
to thinkin...@googlegroups.com
It's not so much the user of the script, but who calls it (can a *nix
expert please correct me if I'm wrong).

--
Pat

On 17/08/2008, at 2:29 PM, PJAY79 wrote:

> Well, I have a 'thinkingsphinxrestart.sh' script, with user and group
> ownership of 'pj'

Julio Cesar

unread,
Aug 18, 2008, 7:06:00 PM8/18/08
to Thinking Sphinx
That's correct. Unless the program will setuid (as in the syscall,
google it), in which case you'd most likely need to run it as root and
the software itself would drop privileges, it'll run as the user who
invoked it.

@PJAY79: Use sudo -u <user> <command calling the rake task>. You just
have to make sure that the user invoking sudo is in the sudoers file
and plus, said user doesn't require a password to sudo to <user>.

You can find extensive information on how to use sudo throughout the
interwebs if you need.
Reply all
Reply to author
Forward
Message has been deleted
0 new messages