Skip to content

Instantly share code, notes, and snippets.

@helms-charity
Created February 2, 2016 04:06
Show Gist options
  • Save helms-charity/926c413c60058b3d316c to your computer and use it in GitHub Desktop.
Save helms-charity/926c413c60058b3d316c to your computer and use it in GitHub Desktop.
Startup script for Adobe CQ 5.6, tested on CentOS 6.5
+-----------------------+
| /etc/rc.d/init.d/cq5 |
+-----------------------+
#!/bin/bash
#
# cq5 Startup script for Adobe AEM/CQ5
#
# chkconfig: 345 80 20
# description: Startup script for Adobe AEM/CQ5
#
# config: /etc/default/$NAME
#
# source function library
. /etc/rc.d/init.d/functions
NAME=cq5
DEFAULT=/etc/default/$NAME
PIDFILE=/var/run/$NAME.pid
# -------------------------------------------------------------------------------------------------------------
# Do NOT change anything after this line. To change any default values edit the $DEFAULT file defined above.
#--------------------------------------------------------------------------------------------------------------
[ -r "$DEFAULT" ] && . $DEFAULT
if [ -z "$CQ_ROOT" ]; then
echo "No CQ_ROOT set."
exit 1
fi
if [ ! -d "$CQ_ROOT" ]; then
echo "The defined CQ root directory [$CQ_ROOT] does not exist."
echo "Please make sure it points to a valid CQ5 root directory."
echo "A valid root directory contains the CQ5 jar file, license.properties and crx-quickstart subfolder."
exit 1
else
CQ_QUICKSTART=$CQ_ROOT/crx-quickstart
fi
if [ -z $CQ_USER ]; then
CQ_USER="cq5"
fi
if [ -z $CQ_JARFILE ]; then
CQ_JARFILE=`ls $CQ_QUICKSTART/app/*.jar | head -1`
fi
start() {
echo "Starting Adobe AEM/CQ5"
if [ -z "$CQ_PORT" ]; then
CQ_PORT=4502
fi
if [ -z "$CQ_RUNMODE" ]; then
CQ_RUNMODE=author,local
fi
if [ -z "$CQ_JAAS_CONFIG" ]; then
CQ_JAAS_CONFIG="etc/jaas.config"
fi
if [ -z "$CQ_FILE_SIZE_LIMIT" ]; then
CQ_FILE_SIZE_LIMIT=8192
fi
if [ $CQ_FILE_SIZE_LIMIT ]; then
CURRENT_ULIMIT=`ulimit`
if [ $CURRENT_ULIMIT != "unlimited" ]; then
if [ $CURRENT_ULIMIT -lt $CQ_FILE_SIZE_LIMIT ]; then
echo "ulimit ${CURRENT_ULIMIT} is too small - must be at least ${CQ_FILE_SIZE_LIMIT}"
exit 1
fi
fi
fi
START_OPTS="start -c $CQ_QUICKSTART -i launchpad"
if [ $CQ_PORT ]; then
START_OPTS="$START_OPTS -p $CQ_PORT"
fi
if [ $CQ_RUNMODE ]; then
CQ_JVM_OPTS="$CQ_JVM_OPTS -Dsling.run.modes=$CQ_RUNMODE"
fi
if [ $CQ_HOST ]; then
CQ_JVM_OPTS="$CQ_JVM_OPTS -Dorg.apache.felix.http.host=$CQ_HOST"
START_OPTS="$START_OPTS -a $CQ_HOST"
fi
if [ $CQ_USE_JAAS ]; then
CQ_JVM_OPTS="$CQ_JVM_OPTS -Djava.security.auth.login.config=$CQ_JAAS_CONFIG"
fi
daemon --user=$CQ_USER "java $CQ_JVM_OPTS -jar $CQ_JARFILE $START_OPTS 2>&1 > /dev/null &"
}
case "$1" in
start)
start
;;
stop)
echo "Stopping Adobe AEM/CQ5"
daemon "java -jar $CQ_JARFILE stop -c $CQ_QUICKSTART &"
;;
*)
echo "Usage: service cq5 {start|stop}"
exit 1
;;
esac
+-----------------------+
| /etc/default/cq5 |
+-----------------------+
CQ_USER=cq5
CQ_ROOT=/data/cq5/author1
CQ_PORT=4501
#CQ_HOST=
#CQ_INTERFACE=
CQ_RUNMODE=author,crx,testmode
#CQ_JARFILE=''
#CQ_USE_JAAS='true'
#CQ_JAAS_CONFIG=
#CQ_FILE_SIZE_LIMIT=
CQ_JVM_OPTS="-server"
CQ_JVM_OPTS="-Djava.awt.headless=true $CQ_JVM_OPTS"
CQ_JVM_OPTS="-XX:NewRatio=1 -XX:SurvivorRatio=12 $CQ_JVM_OPTS"
CQ_JVM_OPTS="-XX:+UseParallelGC -XX:+UseParallelOldGC -XX:ParallelGCThreads=4 $CQ_JVM_OPTS"
CQ_JVM_OPTS="-XX:+HeapDumpOnOutOfMemoryError -XX:HeapDumpPath=/tmp $CQ_JVM_OPTS"
CQ_JVM_OPTS="-Djava.io.tmpdir=/tmp $CQ_JVM_OPTS"
CQ_JVM_OPTS="-Xms8192m -Xmx8192m -XX:PermSize=256m -XX:MaxPermSize=1024m $CQ_JVM_OPTS"
CQ_JVM_OPTS="-Djackrabbit.maxQueuedEvents=1000000 $CQ_JVM_OPTS"
CQ_JVM_OPTS="-Dcom.day.crx.persistence.tar.IndexMergeDelay=0 $CQ_JVM_OPTS"
# only activate when debugging is required
#CQ_DEBUG_PORT=50505
#CQ_JVM_OPTS="-Xdebug -Xnoagent -Xrunjdwp:transport=dt_socket,address=$CQ_DEBUG_PORT,server=y,suspend=n $CQ_JVM_OPTS"
# in case of heap errors increase the heap space or attach the -nofork command to CQ_JVM_OPTS
@helms-charity
Copy link
Author

will edit for Lubuntu

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment