2 SETLOCAL ENABLEDELAYEDEXPANSION
4 IF NOT EXIST "%JAVA_HOME%" (
5 ECHO JAVA_HOME environment variable is not set
15 SET consoleOpts=-console -consoleLog
21 IF "!CARG!"=="-debug" (
26 IF "!CARG!"=="-debugsuspend" (
28 SET debugSuspended=true
32 IF "!CARG!"=="-debugport" (
43 IF "!CARG!"=="-jmxport" (
49 IF "!CARG!"=="-start" (
54 IF "!CARG!"=="-consoleport" (
59 IF "!CARG!"=="-console" (
63 IF "!CARG!"=="-status" (
64 for /F "TOKENS=1" %%G in ('%JAVA_HOME%\bin\jps.exe -lvV ^| find /I "opendaylight"') do (
68 ECHO Controller is running with PID !PID!
70 ECHO Controller is not running.
74 IF "!CARG!"=="-stop" (
75 for /F "TOKENS=1" %%G in ('%JAVA_HOME%\bin\jps.exe -lvV ^| find /I "opendaylight"') do (
79 ECHO Stopping controller PID !PID!
80 TASKKILL /F /PID !PID!
82 ECHO Controller is not running.
86 IF "!CARG:~0,4!"=="-Xmx" (
87 SET jvmMaxMemory=!CARG!
91 IF "!CARG:~0,2!"=="-D" (
92 SET extraJVMOpts=%extraJVMOpts% !CARG!
96 IF "!CARG:~0,2!"=="-X" (
97 SET extraJVMOpts=%extraJVMOpts% !CARG!
101 IF "!CARG!"=="-help" (
102 ECHO "Usage: %0 [-jmx] [-jmxport <num>] [-debug] [-debugsuspend] [-debugport <num>] [-start] [-consoleport <num>]] [-stop] [-status] [-console] [-help] [<other args will automatically be used for the JVM>]"
103 ECHO Note: Enclose any JVM or System properties within double quotes.
107 ECHO "Unknown option: !CARG!"
111 IF "%debugEnabled%" NEQ "" (
112 REM ECHO "DEBUG enabled"
113 SET extraJVMOpts=%extraJVMOpts% -Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=%debugport%
115 IF "%debugSuspended%" NEQ "" (
116 REM ECHO "DEBUG enabled suspended"
117 SET extraJVMOpts=%extraJVMOpts% -Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=%debugport%
120 IF "%jvmMaxMemory%"=="" (
121 SET jvmMaxMemory=-Xmx1G
122 ECHO *****************************************************************
123 ECHO JVM maximum memory was not defined. Setting maximum memory to 1G.
124 ECHO To define the maximum memory, specify the -Xmx setting on the
126 ECHO e.g. run.bat -Xmx1G
127 ECHO *****************************************************************"
130 SET extraJVMOpts=%extraJVMOpts% %jvmMaxMemory%
132 IF "%jmxEnabled%" NEQ "" (
133 REM ECHO "JMX enabled "
134 SET extraJVMOpts=%extraJVMOpts% -Dcom.sun.management.jmxremote.authenticate=false -Dcom.sun.management.jmxremote.ssl=false -Dcom.sun.management.jmxremote.port=%jmxport% -Dcom.sun.management.jmxremote
136 IF "%startEnabled%" NEQ "" (
137 REM ECHO "START enabled "
138 SET consoleOpts=-console %consoleport% -consoleLog
141 REM Check if controller is already running
142 for /F "TOKENS=1" %%G in ('%JAVA_HOME%\bin\jps.exe -lvV ^| find /I "opendaylight"') do (
146 ECHO Controller is already running with PID !PID!
151 REM Now set the classpath:
152 SET cp="%basedir%lib\org.eclipse.osgi-3.8.1.v20120830-144521.jar;%basedir%lib\org.eclipse.virgo.kernel.equinox.extensions-3.6.0.RELEASE.jar;%basedir%lib\org.eclipse.equinox.launcher-1.3.0.v20120522-1813.jar"
154 REM Now set framework classpath
155 SET fwcp="file:\%basedir%lib\org.eclipse.osgi-3.8.1.v20120830-144521.jar,file:\%basedir%lib\org.eclipse.virgo.kernel.equinox.extensions-3.6.0.RELEASE.jar,file:\%basedir%lib\org.eclipse.equinox.launcher-1.3.0.v20120522-1813.jar"
157 SET RUN_CMD="%JAVA_HOME%\bin\java.exe" -Dopendaylight.controller %extraJVMOpts% -Djava.io.tmpdir="%basedir%work\tmp" -Djava.awt.headless=true -Dosgi.install.area=%basedir% -Dosgi.configuration.area="%basedir%configuration" -Dosgi.frameworkClassPath=%fwcp% -Dosgi.framework="file:\%basedir%lib\org.eclipse.osgi-3.8.1.v20120830-144521.jar" -classpath %cp% org.eclipse.equinox.launcher.Main %consoleOpts%
161 if "%startEnabled%" NEQ "" (
162 START /B cmd /C CALL %RUN_CMD% > %basedir%\logs\controller.out 2>&1
163 ECHO Running controller in the background.