echo off

set SERVICE_NAME=Tomcat6

call init.bat

rem /***********************************************************************/
rem /*  Javaの設定です                                                     */
rem /*  メモリの使用量等を指定します(通常起動とは、パラメータ名が違うため  */
rem /*  ここで設定します                                                   */
rem /***********************************************************************/
set JvmMs=64
set JvmMx=512
rem /***********************************************************************/

call %CATALINA_HOME%\bin\service.bat install %SERVICE_NAME%

set EXECUTABLE=%CATALINA_HOME%\bin\tomcat6.exe

"%EXECUTABLE%" //US//%SERVICE_NAME% --JvmMs %JvmMs% --JvmMx %JvmMx%

"%EXECUTABLE%" //US//%SERVICE_NAME% ++JvmOptions ^
	"-DshutdownPort=%SHUTDOWN_PORT%;-DconnectorPort=%CONNECTOR_PORT%;-DajpPort=%AJP_PORT%;"

"%EXECUTABLE%" //US//%SERVICE_NAME% ++JvmOptions ^
	"-DengineName=%ENGINE_NAME%;-DconnectionUrl=%REALM_URL%;-DconnectionName=%REALM_NAME%;"

"%EXECUTABLE%" //US//%SERVICE_NAME% ++JvmOptions ^
	"-DconnectionPassword=%REALM_PASSWORD%;-DappBase=%APP_BASE%;-DworkDir=%WORK_DIR%;-DlogsDir=%LOGS_DIR%;-DSYS_LOG_URL=%SYS_LOG_URL%;"

"%EXECUTABLE%" //US//%SERVICE_NAME% ++JvmOptions ^
	"-Xloggc:%CATALINA_HOME%\logs\%ENGINE_NAME%\gc.log;-XX:+PrintGCDetails;-XX:+PrintClassHistogram;"

"%EXECUTABLE%" //US//%SERVICE_NAME% --Environment ^
	"REALM_URL=%REALM_URL%;REALM_NAME=%REALM_NAME%;REALM_PASSWORD=%REALM_PASSWORD%;"

"%EXECUTABLE%" //US//%SERVICE_NAME% ++Environment ^
	"OFFICE_HOME=%OFFICE_HOME%;CONNECTOR_PORT=%CONNECTOR_PORT%;PATH='%PATH%;';"

sc config Tomcat6 start= auto
sc start Tomcat6

pause