Thanks for the explaination.  I finally get the event listener working.
To close the record, I listed the working configuration below.  It is
sometime useful to use relative path in the case of setting multiple
solr instances on the same server or have to set up dev / test
environments that may not have the exact directory structure as the
directory of the final production environment.

    <listener event="postCommit" class="solr.RunExecutableListener">
      <str name="exe">solr/bin/snapshooter</str>
      <str name="dir">.</str>
      <bool name="wait">true</bool>
      <arr name="args"> <str>arg1</str> <str>arg2</str> </arr>
      <arr name="env"> <str>MYVAR=val1</str> </arr>
    </listener>

Is it possible to update the example config file enclosed in the
distribution as it is not working.

Daniel Wu 

-----Original Message-----
From: Bill Au [mailto:[EMAIL PROTECTED] 
Sent: Tuesday, August 14, 2007 6:27 AM
To: solr-user@lucene.apache.org
Subject: Re: solr doesn't find exe in postCommit event


The element <str name="dir"> specifies the working directory for the
call to Runtime.exec().  You still need to set up your PATH if you don't
use an absolute path for the "exe" element.  As Chris has pointed out,
the best thing to do is to use an absolute path.

Bill


On 8/14/07, Chris Hostetter <[EMAIL PROTECTED]> wrote:
>
>
> : I am trying out the event listener by uncommenting the listener for
> : event postCommit unmodified.  Solr detected the script during start 
> up
> : (otherwise it would throw some exception).  However, when i sent the
>
> no, actually the RunExecutableListener doesn't check for the scripts 
> when it's initialized -- it can't.  you might be asking it to execute 
> a comman that will be found at runtime based on the PATH, it has no 
> way of knowing.
>
> : snippet below).  It seems that solr is not honoring the value of the
> : element <str name="dir">.
>
> "dir" does not need to be the directory where the script is found, as 
> the comment in the example config says it is the directory "...to use 
> as the current working directory."
>
> : The solr is running in tomcat and I started tomcat at the directory
> : above solr home directory.  ( cwd=/home/dwu SolrHome=/home/dwu/solr/

> ).
>
> If you started tomcat with a cwd of /home/dwu and your solr home is 
> /home/dwu/solr/ then the relative dir from the example solrconfig.xml 
> of solr/bin should work -- assuming the user running tomcat has a PATH

> containing "."  (if not, you can always specify it explicitly using 
> the "env" option to RunExecutableListener).
>
> in general, i would recommend always using an absolute path for the 
> "exe" option -- it's just not possible to do that in the example 
> config since we don't know where it will be installed.
>
> : I am not sure if i did something wrong or this is a bug.  Either 
> way, it
> : would be helpful if the exception can tell the full path name the
> : handler is tying to call.
>
> the exception is actaully showing you the full name of hte executible 
> it's trying to execute, that's "snapshooter" ... unfortunately it 
> doesn't show you the working directory it's trying to use (or tell you

> what the PATH is ... but that's kind of a platform specific issue that

> the Runtime class abstracts away from Solr)
>
>
>
> -Hoss
>
>

Reply via email to