Skip to content
This repository has been archived by the owner on May 4, 2023. It is now read-only.

First pass #76

Open
wants to merge 21 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
589cb88
First pass at making the init file more system independent (still LSB).
sbisbee Sep 1, 2010
c621d0e
Rewriting the run binary to deal with its life better.
sbisbee Sep 1, 2010
5bf88e7
fixing typo
sbisbee Sep 1, 2010
c307979
Fixing wrong value to pid file
sbisbee Sep 1, 2010
0b9cf6d
Prevent start if the pid file is there.
sbisbee Sep 1, 2010
a082b15
Making some LSB codes more explicit with variables
sbisbee Sep 1, 2010
4100865
Fixing start code
sbisbee Sep 1, 2010
08c0150
Fixing var order
sbisbee Sep 1, 2010
97a9e85
Adding the usage output
sbisbee Sep 1, 2010
cb00be8
Adding to thanks file
sbisbee Sep 22, 2010
e4ae3e2
Rearranging package format to match the *nix file structure.
sbisbee Sep 22, 2010
dba9760
Adding the other doc files to the package.
sbisbee Sep 22, 2010
a71a89e
Renaming the binary, and updating the init file accordingly
sbisbee Sep 22, 2010
c9a76e2
Shouldn't overwrite PATH.
sbisbee Sep 22, 2010
49a369d
Fixing the assembly file from the shell script rename.
sbisbee Sep 22, 2010
717db0f
Implementing the -p PID file arg and using in the init file.
sbisbee Sep 22, 2010
fa35de3
Forgot to tell getopts to parse the -p arg.
sbisbee Sep 27, 2010
05e02dd
Adding the main class to the jar's manifest - we can now call by jar,…
sbisbee Sep 28, 2010
3eb06a5
Changing how we create the CLASSPATH to play friendlier with our new …
sbisbee Sep 28, 2010
87395a7
Prevent the indexes from being written to the jar or wrapper's cwd.
sbisbee Sep 28, 2010
0a413b9
Put documentation in usr/share/doc/couchdb-lucene
sbisbee Sep 28, 2010
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
1 change: 1 addition & 0 deletions THANKS.md
Expand Up @@ -2,3 +2,4 @@
* Thanks to Paul Davis for contributing the enhanced Javascript indexing API.
* Thanks to Adam Lofts for the performance boosting JSONDocumentAdapter et al.
* Thanks to Santiago M. Mola for the termvector option.
* Thanks to Sam Bisbee.
1 change: 1 addition & 0 deletions pom.xml
Expand Up @@ -165,6 +165,7 @@
<manifest>
<addDefaultImplementationEntries>true</addDefaultImplementationEntries>
<addDefaultSpecificationEntries>true</addDefaultSpecificationEntries>
<mainClass>com.github.rnewson.couchdb.lucene.Main</mainClass>
</manifest>
</archive>
</configuration>
Expand Down
24 changes: 14 additions & 10 deletions src/main/assembly/dist.xml
Expand Up @@ -6,45 +6,49 @@
</formats>
<fileSets>
<fileSet>
<directory>${project.basedir}</directory>
<outputDirectory>/usr/share/doc/couchdb-lucene</outputDirectory>
<includes>
<include>${project.basedir}/README*</include>
<include>${project.basedir}/LICENSE*</include>
<include>${project.basedir}/NOTICE*</include>
<include>README*</include>
<include>LICENSE*</include>
<include>NOTICE*</include>
<include>BREAKING_CHANGES*</include>
<include>TODO*</include>
<include>THANKS*</include>
</includes>
<outputDirectory>/</outputDirectory>
</fileSet>
</fileSets>
<files>
<file>
<source>${project.basedir}/src/main/bin/run</source>
<source>${project.basedir}/src/main/bin/couchdb-lucene</source>
<fileMode>755</fileMode>
<outputDirectory>/bin</outputDirectory>
</file>
<file>
<source>${project.basedir}/src/main/conf/couchdb-lucene.ini</source>
<fileMode>644</fileMode>
<outputDirectory>/conf</outputDirectory>
<outputDirectory>/etc/couchdb-lucene</outputDirectory>
</file>
<file>
<source>${project.basedir}/src/main/conf/log4j.xml</source>
<fileMode>644</fileMode>
<outputDirectory>/conf</outputDirectory>
<outputDirectory>/etc/couchdb-lucene</outputDirectory>
</file>
<file>
<source>${project.basedir}/couchdb-external-hook.py</source>
<fileMode>755</fileMode>
<outputDirectory>/tools</outputDirectory>
<outputDirectory>/bin</outputDirectory>
</file>
<file>
<source>${project.basedir}/src/main/tools/etc/init.d/couchdb-lucene</source>
<fileMode>755</fileMode>
<outputDirectory>/tools/etc/init.d/couchdb-lucene</outputDirectory>
<outputDirectory>/etc/init.d</outputDirectory>
</file>
</files>
<dependencySets>
<dependencySet>
<scope>runtime</scope>
<outputDirectory>/lib</outputDirectory>
<outputDirectory>/lib/couchdb-lucene</outputDirectory>
</dependencySet>
</dependencySets>
</assembly>
90 changes: 90 additions & 0 deletions src/main/bin/couchdb-lucene
@@ -0,0 +1,90 @@
#!/bin/sh

NAME="couchdb-lucene"
BACKGROUND=false #whether to run in the background or not
STDOUT_FILE="" #where to send background stdout to (defaults to &1)
PID_FILE=/var/run/couchdb-lucene/couchdb-lucene.pid

SCRIPT_OK=0
SCRIPT_ERROR=1

printUsage()
{
cat << EOF
Usage: `$basename $0` [OPTIONS]

Starts the couchdb-lucene server component.

Options:

-h displays this short help message and exits

-b spawn as a background process
-o FILE redirect background process's stdout to FILE (defaults to none)
-p FILE set the background process's PID FILE
EOF
}

getPid()
{
[ -f $PID_FILE ] && PID=`cat $PID_FILE`
echo $PID
}

start()
{
CLASSPATH="$CL_BASEDIR/etc/couchdb-lucene:$CL_BASEDIR/lib/couchdb-lucene/*"
JAVA_OPTS="-server -Xmx1g -cp $CLASSPATH"

command="java $JAVA_OPTS $JAR com.github.rnewson.couchdb.lucene.Main"

if [ "$BACKGROUND" != "true" ]
then
eval $command
else
PID=`getPid`

if [ -z "$PID" ]
then
[ -n $STDOUT_FILE ] && command="$command >> $STDOUT_FILE"

eval "$command &"
echo $! > $PID_FILE
else
echo "$NAME is already running ($PID_FILE)."
fi
fi
}

checkEnvironment()
{
prepend="couchdb-lucene needs write access to"
[ ! -w $STDOUT_FILE ] && echo "$prepend output file $STDOUT_FILE" && exit $SCRIPT_ERROR
unset prepend
}

parseOptions()
{
opts=`getopt o:hbp: $@`
set -- $opts
while [ $# -gt 0 ]
do
case "$1" in
-h) shift; printUsage; exit $SCRIPT_OK;;
-o) shift; STDOUT_FILE="$1"; shift;;
-b) shift; BACKGROUND=true;;
-p) shift; PID_FILE="$1"; shift;;
--) shift; break;;
*) echo "Unknown option: $1" >&2; exit $SCRIPT_ERROR;;
esac
done
}

parseOptions $@
checkEnvironment

[ -z $CL_BASEDIR ] && CL_BASEDIR=`dirname "$0"`"/.."
cd $CL_BASEDIR

start

20 changes: 0 additions & 20 deletions src/main/bin/run

This file was deleted.

2 changes: 1 addition & 1 deletion src/main/conf/couchdb-lucene.ini
@@ -1,6 +1,6 @@
[lucene]
# The output directory for Lucene indexes.
dir=indexes
dir=/var/lib/couchdb-lucene/indexes

# The local host name that couchdb-lucene binds to
host=localhost
Expand Down