2 SETLOCAL ENABLEDELAYEDEXPANSION
4 IF NOT EXIST "%JAVA_HOME%" (
5 ECHO JAVA_HOME environment variable is not set
14 SET consoleOpts=-console -consoleLog
20 IF "!CARG!"=="-debug" (
25 IF "!CARG!"=="-debugsuspend" (
27 SET debugSuspended=true
31 IF "!CARG!"=="-debugport" (
42 IF "!CARG!"=="-jmxport" (
48 IF "!CARG!"=="-start" (
53 IF "!CARG!"=="-consoleport" (
58 IF "!CARG!"=="-console" (
62 IF "!CARG!"=="-status" (
63 for /F "TOKENS=1" %%G in ('%JAVA_HOME%\bin\jps.exe -lvV ^| find /I "opendaylight"') do (
67 ECHO Controller is running with PID !PID!
69 ECHO Controller is not running.
73 IF "!CARG!"=="-stop" (
74 for /F "TOKENS=1" %%G in ('%JAVA_HOME%\bin\jps.exe -lvV ^| find /I "opendaylight"') do (
78 ECHO Stopping controller PID !PID!
79 TASKKILL /F /PID !PID!
81 ECHO Controller is not running.
85 IF "!CARG:~0,2!"=="-D" (
86 SET extraJVMOpts=%extraJVMOpts% !CARG!
90 IF "!CARG:~0,2!"=="-X" (
91 SET extraJVMOpts=%extraJVMOpts% !CARG!
95 IF "!CARG!"=="-help" (
96 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>]"
97 ECHO Note: Enclose any JVM or System properties within double quotes.
101 ECHO "Unknown option: !CARG!"
105 IF "%debugEnabled%" NEQ "" (
106 REM ECHO "DEBUG enabled"
107 SET extraJVMOpts=%extraJVMOpts% -Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=%debugport%
109 IF "%debugSuspended%" NEQ "" (
110 REM ECHO "DEBUG enabled suspended"
111 SET extraJVMOpts=%extraJVMOpts% -Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=%debugport%
113 IF "%jmxEnabled%" NEQ "" (
114 REM ECHO "JMX enabled "
115 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
117 IF "%startEnabled%" NEQ "" (
118 REM ECHO "START enabled "
119 SET consoleOpts=-console %consoleport% -consoleLog
122 REM Check if controller is already running
123 for /F "TOKENS=1" %%G in ('%JAVA_HOME%\bin\jps.exe -lvV ^| find /I "opendaylight"') do (
127 ECHO Controller is already running with PID !PID!
132 REM Now set the classpath:
133 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"
135 REM Now set framework classpath
136 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"
138 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%
142 if "%startEnabled%" NEQ "" (
143 START /B cmd /C CALL %RUN_CMD% > %basedir%\logs\controller.out 2>&1
144 ECHO Running controller in the background.