domain.bat 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138
  1. @echo off
  2. rem -------------------------------------------------------------------------
  3. rem JBoss Bootstrap Script for Windows
  4. rem -------------------------------------------------------------------------
  5. rem $Id$
  6. @if not "%ECHO%" == "" echo %ECHO%
  7. @if "%OS%" == "Windows_NT" setlocal
  8. if "%OS%" == "Windows_NT" (
  9. set "DIRNAME=%~dp0%"
  10. ) else (
  11. set DIRNAME=.\
  12. )
  13. rem Read an optional configuration file.
  14. if "x%DOMAIN_CONF%" == "x" (
  15. set "DOMAIN_CONF=%DIRNAME%domain.conf.bat"
  16. )
  17. if exist "%DOMAIN_CONF%" (
  18. echo Calling "%DOMAIN_CONF%"
  19. call "%DOMAIN_CONF%" %*
  20. ) else (
  21. echo Config file not found "%DOMAIN_CONF%"
  22. )
  23. pushd %DIRNAME%..
  24. set "RESOLVED_JBOSS_HOME=%CD%"
  25. popd
  26. if "x%JBOSS_HOME%" == "x" (
  27. set "JBOSS_HOME=%RESOLVED_JBOSS_HOME%"
  28. )
  29. pushd "%JBOSS_HOME%"
  30. set "SANITIZED_JBOSS_HOME=%CD%"
  31. popd
  32. if "%RESOLVED_JBOSS_HOME%" NEQ "%SANITIZED_JBOSS_HOME%" (
  33. echo WARNING JBOSS_HOME may be pointing to a different installation - unpredictable results may occur.
  34. )
  35. set DIRNAME=
  36. if "%OS%" == "Windows_NT" (
  37. set "PROGNAME=%~nx0%"
  38. ) else (
  39. set "PROGNAME=domain.bat"
  40. )
  41. rem Setup JBoss specific properties
  42. set JAVA_OPTS=-Dprogram.name=%PROGNAME% %JAVA_OPTS%
  43. if "x%JAVA_HOME%" == "x" (
  44. set JAVA=java
  45. echo JAVA_HOME is not set. Unexpected results may occur.
  46. echo Set JAVA_HOME to the directory of your local JDK to avoid this message.
  47. ) else (
  48. set "JAVA=%JAVA_HOME%\bin\java"
  49. )
  50. rem Add -server to the JVM options, if supported
  51. "%JAVA%" -server -version 2>&1 | findstr /I hotspot > nul
  52. if not errorlevel == 1 (
  53. set "PROCESS_CONTROLLER_JAVA_OPTS=%PROCESS_CONTROLLER_JAVA_OPTS% -server"
  54. set "HOST_CONTROLLER_JAVA_OPTS=%HOST_CONTROLLER_JAVA_OPTS% -server"
  55. )
  56. rem Find run.jar, or we can't continue
  57. if exist "%JBOSS_HOME%\jboss-modules.jar" (
  58. set "RUNJAR=%JBOSS_HOME%\jboss-modules.jar"
  59. ) else (
  60. echo Could not locate "%JBOSS_HOME%\jboss-modules.jar".
  61. echo Please check that you are in the bin directory when running this script.
  62. goto END
  63. )
  64. rem Setup JBoss specific properties
  65. rem Setup the java endorsed dirs
  66. set JBOSS_ENDORSED_DIRS=%JBOSS_HOME%\lib\endorsed
  67. rem Set default module root paths
  68. if "x%JBOSS_MODULEPATH%" == "x" (
  69. set "JBOSS_MODULEPATH=%JBOSS_HOME%\modules"
  70. )
  71. rem Set the domain base dir
  72. if "x%JBOSS_BASE_DIR%" == "x" (
  73. set "JBOSS_BASE_DIR=%JBOSS_HOME%\domain"
  74. )
  75. rem Set the domain log dir
  76. if "x%JBOSS_LOG_DIR%" == "x" (
  77. set "JBOSS_LOG_DIR=%JBOSS_BASE_DIR%\log"
  78. )
  79. rem Set the domain configuration dir
  80. if "x%JBOSS_CONFIG_DIR%" == "x" (
  81. set "JBOSS_CONFIG_DIR=%JBOSS_BASE_DIR%/configuration"
  82. )
  83. echo ===============================================================================
  84. echo.
  85. echo JBoss Bootstrap Environment
  86. echo.
  87. echo JBOSS_HOME: %JBOSS_HOME%
  88. echo.
  89. echo JAVA: %JAVA%
  90. echo.
  91. echo JAVA_OPTS: %JAVA_OPTS%
  92. echo.
  93. echo ===============================================================================
  94. echo.
  95. :RESTART
  96. "%JAVA%" %PROCESS_CONTROLLER_JAVA_OPTS% ^
  97. "-Dorg.jboss.boot.log.file=%JBOSS_LOG_DIR%\process-controller.log" ^
  98. "-Dlogging.configuration=file:%JBOSS_CONFIG_DIR%/logging.properties" ^
  99. -jar "%JBOSS_HOME%\jboss-modules.jar" ^
  100. -mp "%JBOSS_MODULEPATH%" ^
  101. org.jboss.as.process-controller ^
  102. -jboss-home "%JBOSS_HOME%" ^
  103. -jvm "%JAVA%" ^
  104. -mp "%JBOSS_MODULEPATH%" ^
  105. -- ^
  106. "-Dorg.jboss.boot.log.file=%JBOSS_LOG_DIR%\host-controller.log" ^
  107. "-Dlogging.configuration=file:%JBOSS_CONFIG_DIR%/logging.properties" ^
  108. %HOST_CONTROLLER_JAVA_OPTS% ^
  109. -- ^
  110. -default-jvm "%JAVA%" ^
  111. %*
  112. if ERRORLEVEL 10 goto RESTART
  113. :END
  114. if "x%NOPAUSE%" == "x" pause
  115. :END_NO_PAUSE