Author: ogrisel
Date: Thu Nov 10 01:03:00 2011
New Revision: 1200076
URL: http://svn.apache.org/viewvc?rev=1200076&view=rev
Log:
simple init.d script using start-stop-daemon
Added:
incubator/stanbol/trunk/tools/
incubator/stanbol/trunk/tools/README.md
incubator/stanbol/trunk/tools/stanbol (with props)
Added: incubator/stanbol/trunk/tools/README.md
URL:
http://svn.apache.org/viewvc/incubator/stanbol/trunk/tools/README.md?rev=1200076&view=auto
==============================================================================
--- incubator/stanbol/trunk/tools/README.md (added)
+++ incubator/stanbol/trunk/tools/README.md Thu Nov 10 01:03:00 2011
@@ -0,0 +1,3 @@
+# Utilities for sysadmin and developers
+
+- stanbol: a startup script to put in your /etc/init.d/ on Linux
Added: incubator/stanbol/trunk/tools/stanbol
URL:
http://svn.apache.org/viewvc/incubator/stanbol/trunk/tools/stanbol?rev=1200076&view=auto
==============================================================================
--- incubator/stanbol/trunk/tools/stanbol (added)
+++ incubator/stanbol/trunk/tools/stanbol Thu Nov 10 01:03:00 2011
@@ -0,0 +1,102 @@
+#! /bin/sh
+
+### BEGIN INIT INFO
+# Provides: stanbol
+# Default-Start: 2 3 4 5
+# Default-Stop:
+# Short-Description: Semantic HTTP services
+# Description: stanbol is HTTP service that provides semantic analysis
and
+# indexing tools for Content Management Systems.
+### END INIT INFO
+
+set -e
+
+# /etc/init.d/stanbol: start and stop the stanbol server
+
+# Runtime parameters - feel free to customize:
+JAVA=/usr/bin/java
+JAVA_OPTS='-Xmx2g'
+STANBOL_DIR="/opt/stanbol"
+STANBOL_JAR="$STANBOL_DIR/stanbol-launcher.jar"
+STANBOL_PID_FILE="$STANBOL_DIR/stanbol.pid"
+STANBOL_PORT=8080
+STANBOL_OPTS=''
+
+# TODO: make it possible to configure log files and rotation
+
+test -x $JAVA || exit 0
+
+. /lib/lsb/init-functions
+
+export PATH="${PATH:+$PATH:}/usr/sbin:/sbin"
+
+
+stanbol_start() {
+ if start-stop-daemon --start --quiet --background \
+ --chdir $STANBOL_DIR \
+ --pidfile $STANBOL_PID_FILE --make-pidfile \
+ --exec $JAVA -- $JAVA_OPTS -jar $STANBOL_JAR \
+ -p $STANBOL_PORT $STANBOL_OPTS
+ then
+ rc=0
+ sleep 5
+ if ! kill -0 $(cat $STANBOL_PID_FILE) >/dev/null 2>&1; then
+ log_failure_msg "stanbol daemon failed to start"
+ rc=1
+ fi
+ else
+ rc=1
+ fi
+ if [ $rc -eq 0 ]; then
+ log_end_msg 0
+ else
+ log_end_msg 1
+ rm -f $STANBOL_PID_FILE
+ fi
+} # stanbol_start
+
+
+case "$1" in
+ start)
+ log_daemon_msg "Starting stanbol daemon on port $STANBOL_PORT"
+ if [ -s $STANBOL_PID_FILE ] && kill -0 $(cat $STANBOL_PID_FILE)
>/dev/null 2>&1; then
+ log_progress_msg "apparently already running"
+ log_end_msg 0
+ exit 0
+ fi
+ stanbol_start
+ ;;
+ stop)
+ log_daemon_msg "Stopping stanbol daemon" "stanbol"
+ start-stop-daemon --stop --quiet --oknodo --pidfile $STANBOL_PID_FILE
+ log_end_msg $?
+ rm -f $STANBOL_PID_FILE
+ ;;
+
+ reload|force-reload)
+ log_warning_msg "Reloading stanbol daemon does nothing"
+ ;;
+
+ restart)
+ set +e
+ log_daemon_msg "Restarting stanbol daemon" "stanbol"
+ if [ -s $STANBOL_PID_FILE ] && kill -0 $(cat $STANBOL_PID_FILE)
>/dev/null 2>&1; then
+ start-stop-daemon --stop --quiet --oknodo --pidfile
$STANBOL_PID_FILE || true
+ sleep 5
+ else
+ log_warning_msg "stanbol daemon not running, attempting to start."
+ rm -f $STANBOL_PID_FILE
+ fi
+ stanbol_start
+ ;;
+
+ status)
+ status_of_proc -p $STANBOL_PID_FILE "$JAVA" stanbol
+ exit $? # notreached due to set -e
+ ;;
+ *)
+ echo "Usage: /etc/init.d/stanbol
{start|stop|reload|force-reload|restart|status}"
+ exit 1
+esac
+
+exit 0
Propchange: incubator/stanbol/trunk/tools/stanbol
------------------------------------------------------------------------------
svn:executable = *