Skip to content

Instantly share code, notes, and snippets.

@jayankandathil
Last active June 16, 2017 15:31
Show Gist options
  • Save jayankandathil/bb5e2978cc982ac2c234 to your computer and use it in GitHub Desktop.
Save jayankandathil/bb5e2978cc982ac2c234 to your computer and use it in GitHub Desktop.
Adobe AEM 6.0 Windows start.bat for MongoDB (DEV environment)
@echo off
:: This script configures the start information for this server.
::
:: The following variables may be used to override the defaults.
:: For one-time overrides the variable can be set as part of the command-line; e.g.,
::
:: SET CQ_PORT=1234 & ./start.bat
::
setlocal
::* TCP port used for stop and status scripts
set CQ_PORT=4502
::* hostname of the interface that this server should listen to
:: if not defined CQ_HOST set CQ_HOST=
::* runmode(s)
set CQ_RUNMODE="author,crx3mongo"
::* name of the jarfile
:: if not defined CQ_JARFILE set CQ_JARFILE=
::* use jaas.config
:: if not defined CQ_USE_JAAS set CQ_USE_JAAS=true
::* config for jaas
set CQ_JAAS_CONFIG=etc\jaas.config
::* -------------------
::* Default JVM options
::* -------------------
set CQ_JVM_OPTS=-server
set CQ_JVM_OPTS=%CQ_JVM_OPTS% -Djava.awt.headless=true
set CQ_JVM_OPTS=%CQ_JVM_OPTS% -Xms4096m
set CQ_JVM_OPTS=%CQ_JVM_OPTS% -Xmx4096m
set CQ_JVM_OPTS=%CQ_JVM_OPTS% -XX:PermSize=256m
set CQ_JVM_OPTS=%CQ_JVM_OPTS% -XX:MaxPermSize=512m
set CQ_JVM_OPTS=%CQ_JVM_OPTS% -XX:NewRatio=1
set CQ_JVM_OPTS=%CQ_JVM_OPTS% -XX:+UseParallelGC
set CQ_JVM_OPTS=%CQ_JVM_OPTS% -XX:+UseParallelOldGC
set CQ_JVM_OPTS=%CQ_JVM_OPTS% -Djava.io.tmpdir=C:\JAVA_TEMP
set CQ_JVM_OPTS=%CQ_JVM_OPTS% -XX:+HeapDumpOnOutOfMemoryError
set CQ_JVM_OPTS=%CQ_JVM_OPTS% -XX:HeapDumpPath=C:\TEMP
set CQ_JVM_OPTS=%CQ_JVM_OPTS% -Doak.mongo.uri=mongodb://localhost:27017
::* ------------------------------------------------------------------------------
::* do not configure below this point
::* ------------------------------------------------------------------------------
chdir /D %~dp0
cd ..
del conf\controlport
if not defined CQ_JARFILE for %%X in (app\*.jar) do set CQ_JARFILE=%%X
for %%* in (.) do set CurrDirName=%%~n*
cd ..
set START_OPTS=start -c %CurrDirName% -i launchpad
if defined CQ_PORT set START_OPTS=%START_OPTS% -p %CQ_PORT%
if defined CQ_RUNMODE set CQ_JVM_OPTS=%CQ_JVM_OPTS% -Dsling.run.modes=%CQ_RUNMODE%
if defined CQ_HOST set CQ_JVM_OPTS=%CQ_JVM_OPTS% -Dorg.apache.felix.http.host=%CQ_HOST%
if defined CQ_HOST set START_OPTS=%START_OPTS% -a %CQ_HOST%
if defined CQ_USE_JAAS set CQ_JVM_OPTS=%CQ_JVM_OPTS% -Djava.security.auth.login.config=%CQ_JAAS_CONFIG%
set START_OPTS=%START_OPTS% -Dsling.properties=conf/sling.properties
tasklist > oldTaskList.txt
start "CQ" cmd.exe /K java %CQ_JVM_OPTS% -jar %CurrDirName%\%CQ_JARFILE% %START_OPTS%
tasklist > newTaskList.txt
java -cp %~dp0 GetProcessID oldTaskList.txt newTaskList.txt java.exe > %CurrDirName%\conf\cq.pid
del newTaskList.txt
del oldTaskList.txt
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment