NAME

Sphinx::Control - Simple class to manage a Sphinx searchd

SYNOPSIS

  use Sphinx::Control;
  
  my ($command) = @ARGV;
  
  my $ctl = Sphinx::Control->new(
      config_file => [qw[ conf sphinx.conf ]],
      # PID file can also be discovered automatically 
      # from the conf, or if you prefer you can specify
      pid_file    => 'searchd.pid',    
  );

  $ctl->start if lc($command) eq 'start';
  $ctl->stop  if lc($command) eq 'stop';

DESCRIPTION

This is a fork of Lighttpd::Control to work with Sphinx searchd, it maintains 100% API compatibility. In fact most of this documentation was stolen too. This is an early release with only the bare bones functionality needed, future releases will surely include more functionality. Suggestions and crazy ideas welcomed, especially in the form of patches with tests.

ATTRIBUTES

config_file

This is a Path::Class::File instance for the configuration file.

binary_path

This is a Path::Class::File instance pointing to the searchd binary. This can be autodiscovered or you can specify it via the constructor.

pid_file

This is a Path::Class::File instance pointing to the searchd pid file. This can be autodiscovered from the config file or you can specify it via the constructor.

server_pid

This is the PID of the live server.

METHODS

start

Starts the Sphinx searchd deamon that is currently being controlled by this instance. It will also run the pre_startup and post_startup hooks.

stop

Stops the Sphinx searchd deamon that is currently being controlled by this instance. It will also run the pre_shutdown and post_shutdown hooks.

is_server_running

Checks to see if the Sphinx searchd deamon that is currently being controlled by this instance is running or not (based on the state of the PID file).

log

Simple logger that you can use, it just sends the output to STDERR via the warn function.

SEE ALSO

Sphinx::Manager, Lighttpd::Control, Nginx::Control

AUTHOR

Fayland Lam, <fayland at gmail.com>

COPYRIGHT & LICENSE

Copyright 2008 Fayland Lam

except for those parts that are

Copyright 2008 Infinity Interactive, Inc.

http://www.iinteractive.com

This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.