Permalink
Browse files

Wrote an init-script and short README to get etherpad working on redhat

  • Loading branch information...
1 parent 855f02a commit 45c551967090fb1664dbb44d95a46f9ed606ceb0 @LarsFronius LarsFronius committed Mar 29, 2011
Showing with 131 additions and 0 deletions.
  1. +15 −0 redhat/README
  2. +101 −0 redhat/etherpad.init
  3. +15 −0 redhat/etherpad.sysconfig
View
@@ -0,0 +1,15 @@
+This is a init-script and sysconfig-file to start etherpad on redhat.
+
+I recommend installing openoffice >= 3.2.1.
+You can get the package from http://download.services.openoffice.org/files/stable/3.2.1/OOo_3.2.1_Linux_x86-64_install-rpm_en-US.tar.gz
+Package openoffice.org-ure-1.6.1-9502.x86_64.rpm is important to install.
+
+Scala < 2.8 should also be installed. You can get the package from http://www.scala-lang.org/sites/default/files/linuxsoft_archives/downloads/distrib/files/scala-2.7.7.final.tgz
+
+You should also install jdk and mysql-connector-java in the appropriate version (>5.0.4).
+
+After checking out etherpad from git, please adjust the bin/exports.sh file to the folders where jdk, mysql-connector-java and scala is installed.
+For me these are the values in the etherpad.sysconfig file.
+
+When etherpad is installed, please copy the etherpad.sysconfig file to /etc/sysconfig/etherpad and the etherpad.init file to /etc/init.d/etherpad.
+You can now start etherpad using "service etherpad start" and stop using "service etherpad stop".
View
@@ -0,0 +1,101 @@
+#!/bin/bash
+#
+# etherpad Startup script for Etherpad
+#
+# chkconfig: - 345 99
+# description: Collaborative real-time editor
+# processname: etherpad
+# config: /etc/sysconfig/etherpad
+# config: ${ETHERPAD_HOME}/etherpad/etc/etherpad.local.propeties
+# pidfile: /var/run/etherpad/etherpad.pid
+# pidfile: /var/run/etherpad/soffice.pid
+
+# Source function library.
+. /etc/init.d/functions
+
+# Load Environment Variables.
+if [ -f /etc/sysconfig/etherpad ]; then
+ . /etc/sysconfig/etherpad
+fi
+
+CP="appjet-eth-dev.jar:data"
+for f in $ETHERPAD_HOME/etherpad/lib/*.jar; do
+ CP="$CP:$f"
+done
+
+sname="soffice"
+slockfile="/var/lock/subsys/${sname}"
+spidfile="${PID_HOME}/${sname}.pid"
+slogfile="/var/log/${sname}.log"
+sargs="-nologo -nofirststartwizard -headless -norestore -invisible \"-accept=socket,host=localhost,port=8100;urp;StarOffice.Service\""
+
+ename="etherpad"
+elockfile="/var/lock/subsys/${ename}"
+epidfile="${PID_HOME}/${ename}.pid"
+elogfile="/var/log/${ename}.log"
+eargs="-classpath ${CP} -server -Xmx${MAXRAM} -Xms${MAXRAM} -Djava.awt.headless=true -XX:MaxGCPauseMillis=500 -XX:+UseConcMarkSweepGC -XX:+CMSIncrementalMode -XX:CMSIncrementalSafetyFactor=50 -XX:+PrintGCDetails -XX:+PrintGCTimeStamps -Xloggc:./data/logs/backend/jvm-gc.log -Dappjet.jmxremote=true net.appjet.oui.main --configFile=${ETHERPAD_CONFIG} --maxThreads=${MAXTHREADS}"
+
+start() {
+ echo "Starting ${sname}: "
+ ( daemon --user=etherpad ${OOFFICE} ${sargs} >> ${slogfile} ) &
+ [ "$VERBOSE" != no ] && echo -n "Waiting for service to come up ..."
+ for counter in 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20; do
+ fuser -n tcp 8100 > /dev/null 2>&1 && break
+ [ "$VERBOSE" != no ] && echo -n "."
+ sleep 1
+ done
+ [ "$VERBOSE" != no ] && echo ""
+ pgrep -U etherpad soffice >> ${spidfile}
+
+ echo "Starting ${ename}: "
+ ( daemon --user=etherpad ${JAVA} "${eargs}" >> ${elogfile} ) &
+ [ "$VERBOSE" != no ] && echo -n "Waiting for service to come up ..."
+ for counter in 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20; do
+ echo "GET /" | netcat -w 1 localhost 9000 > /dev/null 2>&1 && break
+ [ "$VERBOSE" != no ] && echo -n "."
+ sleep 1
+ done
+ [ "$VERBOSE" != no ] && echo ""
+ pgrep -U etherpad java >> ${epidfile}
+ RETVAL=$?
+ touch ${slockfile}
+ touch ${elockfile}
+ echo "done"
+}
+
+stop() {
+ echo "Stopping ${sname}: "
+ killproc -p ${spidfile}
+ echo "Stopping ${ename}: "
+ killproc -d 30 -p ${epidfile}
+ RETVAL=$?
+ rm -f ${slockfile} ${spidfile} ${elockfile} ${epidfile}
+}
+restart() {
+ stop
+ start
+}
+
+# See how we were called.
+case "$1" in
+ start)
+ start
+ ;;
+ stop)
+ stop
+ ;;
+ status)
+ echo -n ${sname} ;status -p ${spidfile}
+ echo -n ${ename} ;status -p ${epidfile}
+ RETVAL=$?
+ ;;
+ restart)
+ stop
+ start
+ ;;
+ *)
+ echo $"Usage: $prog {start|stop|restart|status}"
+ exit 1
+esac
+
+exit $RETVAL
View
@@ -0,0 +1,15 @@
+# Configuration file for Etherpad
+export ETHERPAD_HOME="/usr/etherpad"
+export ETHERPAD_CONFIG="/etc/etherpad/etherpad.local.properties"
+export OOFFICE_HOME="/opt/openoffice.org3/program"
+export JAVA_HOME="/usr/java/jdk1.6.0_22"
+export SCALA_HOME="/usr/scala"
+export SCALA_LIBRARY_JAR="$SCALA_HOME/lib/scala-library.jar"
+export MYSQL_CONNECTOR_JAR="/usr/share/java/mysql-connector-java-5.0.4.jar"
+export JAVA="$JAVA_HOME/bin/java"
+export SCALA="$SCALA_HOME/bin/scala"
+export OOFFICE="$OOFFICE_HOME/soffice"
+export PID_HOME="/var/run/etherpad"
+export PATH="$JAVA_HOME/bin:$SCALA_HOME/bin:$PATH"
+export MAXRAM="4096M"
+export MAXTHREADS="256"

0 comments on commit 45c5519

Please sign in to comment.