Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Merge pull request #1 from dbu/master

doc improvements
  • Loading branch information...
commit 385e36e40d25a389f212e242d828c524235110bb 2 parents dfc889c + 2a5325f
Dan authored
Showing with 88 additions and 43 deletions.
  1. +33 −4 README
  2. +55 −39 jackrabbit.sh
View
37 README
@@ -3,8 +3,37 @@ Simple script to start / stop a Jackrabbit server.
Author: D. Barsotti <daniel.barsotti@liip.ch>
-This relies on a PID file to check if Jackrabbit is running or not.
-If you kill Jackrabbit without removing the PID file, you will not be
-start Jackrabbit with this script before you manually removed the PID
-file.
+A script to start and stop apache jackrabbit according to the init.d mechanism
+This relies on a PID file to check if Jackrabbit is running.
+If you kill Jackrabbit without removing the PID file, you will not be able to start Jackrabbit with this script until you manually remove the PID file.
+
+Installation
+------------
+
+ mkdir -p /opt/jackrabbit-startup # or wherever you want to put the code
+ cd /opt/jackrabbit-startup
+ git clone https://github.com/sixty-nine/Jackrabbit-startup-script.git
+ ## <edit jackrabbit.sh to configure some settings> ##
+ ln -s /opt/jackrabbit-startup/jackrabbit.sh /etc/init.d/jackrabbit
+ chmod 755 /etc/init.d/jackrabbit
+ # on debian, register with
+ update-rc.d jackrabbit defaults
+ # if not using a system that provides update-rc.d, you hopefully know how
+ # to proceed...
+
+
+Usage
+-----
+
+The service should be started and stopped automatically from now on.
+
+If you ever want to control it manually, you can run
+
+ /etc/init.d/jackrabbit start|stop|status
+
+If you have a pid file blocking startup, you can just stop and then start
+jackrabbit again. You will get an error on stop that you can ignore.
+
+ /etc/init.d/jackrabbit stop
+ /etc/init.d/jackrabbit start
View
94 jackrabbit.sh
@@ -1,70 +1,86 @@
#!/bin/sh
### BEGIN INIT INFO
-# Provides: jackrabbit
-# Description: Start/stop the Jackrabbit server.
-# This relies on a PID file to check if Jackrabbit is running or not.
-# If you kill Jackrabbit without removing the PID file, you will not be
-# start Jackrabbit with this script before you manually removed the PID
-# file.
-# Author: Daniel Barsotti <daniel.barsotti@liip.ch>
+# Provides: jackrabbit
+# Short-Description: Start/stop Jackrabbit JCR server.
+#
+# Description: This relies on a PID file to check if Jackrabbit is running.
+# If you kill Jackrabbit without removing the PID file, you
+# will not be able to start Jackrabbit with this script until
+# you manually remove the PID file.
+# Edit the variables below to configure Jackrabbit
+# Depending on the storage backend, you might want to adjust
+# the required start / stop lines.
+#
+# Default-Start: 2 3 4 5
+# Default-Stop: 0 1 6
+# Required-Start:
+# Required-Stop:
+#
+# Author: Daniel Barsotti <daniel.barsotti@liip.ch>
### END INIT INFO
-### YOU HAVE TO EDIT THESE VALUES !!!
+### PLEASE EDIT THESE VALUES FOR YOUR SETUP
+# directory in which jackrabbit will store local data, must be writeable
BASEDIR=/home/dev/jackalope/jackrabbit
-#JACKRABBIT=$BASEDIR/jackrabbit-standalone-2.2.6-SNAPSHOT.jar
+# full filename of jackrabbit standalone .jar to run
JACKRABBIT_JAR=$BASEDIR/jackrabbit-standalone-2.2.8-jackalope-SNAPSHOT.jar
+# ip address for jackrabbit to listen on. you can make jackrabbit listen on all
+# interfaces by using 0.0.0.0 here.
JACKRABBIT_HOST=127.0.0.1
+# port number to listen on. 8080 is default, you can use something else
JACKRABBIT_PORT=8080
-###
-
+###
+# full filename to the pid file to check if jackrabbit is running
PIDFILE=$BASEDIR/jackrabbit.pid
+# full filename to the logfile to output console output of jackrabbit
+# additionally, jackrabbit has its own logfile
LOGFILE=$BASEDIR/jackrabbit.log
#set -x
do_start() {
- if [ ! -f $PIDFILE ]; then
- cd $BASEDIR
- nohup java -jar $JACKRABBIT_JAR -h $JACKRABBIT_HOST -p $JACKRABBIT_PORT >> $LOGFILE 2>&1 & echo $! > $PIDFILE
- echo "Jackrabbit started"
- else
- echo "Jackrabbit is already running"
- fi
+ if [ ! -f $PIDFILE ]; then
+ cd $BASEDIR
+ nohup java -jar $JACKRABBIT_JAR -h $JACKRABBIT_HOST -p $JACKRABBIT_PORT >> $LOGFILE 2>&1 & echo $! > $PIDFILE
+ echo "Jackrabbit started"
+ else
+ echo "Jackrabbit is already running"
+ fi
}
do_stop() {
- if [ -f $PIDFILE ]; then
- kill $(cat $PIDFILE)
- rm $PIDFILE
- echo "Jackrabbit stopped"
- else
- echo "Jackrabbit is not running"
- fi
+ if [ -f $PIDFILE ]; then
+ kill $(cat $PIDFILE)
+ rm $PIDFILE
+ echo "Jackrabbit stopped"
+ else
+ echo "Jackrabbit is not running"
+ fi
}
do_status() {
- if [ -f $PIDFILE ]; then
+ if [ -f $PIDFILE ]; then
echo "Jackrabbit is running [ pid = " $(cat $PIDFILE) "]"
- else
- echo "Jackrabbit is not running"
- fi
+ else
+ echo "Jackrabbit is not running"
+ fi
}
case "$1" in
start)
- do_start
- ;;
+ do_start
+ ;;
stop)
- do_stop
- ;;
- status)
- do_status
- ;;
+ do_stop
+ ;;
+ status)
+ do_status
+ ;;
*)
- echo "Usage: $SCRIPTNAME {start|stop|status}" >&2
- exit 3
- ;;
+ echo "Usage: $SCRIPTNAME {start|stop|status}" >&2
+ exit 3
+ ;;
esac
Please sign in to comment.
Something went wrong with that request. Please try again.