Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Fetching contributors…

Cannot retrieve contributors at this time

executable file 105 lines (95 sloc) 3.107 kb
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105
#!/bin/bash
#
# etherpad Startup script for Etherpad
#
# chkconfig: 345 99 01
# 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}: "
cd $ETHERPAD_HOME/etherpad
screen -d -m -S etherpad sudo -u etherpad bin/run-local.sh --cfg ${ETHERPAD_CONFIG}
# ( 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
# for counter in 1 2 3 4 5; do
# echo "GET /" | netcat -w 1 localhost 9000 > /dev/null 2>&1 && break
# [ "$VERBOSE" != no ] && echo -n "."
# sleep 1
# done
sleep 1
        [ "$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
Something went wrong with that request. Please try again.