Author: kkolinko Date: Sun Feb 16 15:24:56 2014 New Revision: 1568779 URL: http://svn.apache.org/r1568779 Log: https://issues.apache.org/bugzilla/show_bug.cgi?id=56143 Allow service.bat to be launched from a non-UAC console, by using arguments instead of env variables to pass options to prunsrv.
+ Fix regression in r1567742 that values for --StdOutput, --StdError were lost. + Pass --LogPath option to service removal command, to avoid using default value for this option Modified: tomcat/trunk/bin/service.bat Modified: tomcat/trunk/bin/service.bat URL: http://svn.apache.org/viewvc/tomcat/trunk/bin/service.bat?rev=1568779&r1=1568778&r2=1568779&view=diff ============================================================================== --- tomcat/trunk/bin/service.bat (original) +++ tomcat/trunk/bin/service.bat Sun Feb 16 15:24:56 2014 @@ -75,7 +75,7 @@ set "EXECUTABLE=%CATALINA_HOME%\bin\tomc rem Set default Service name set SERVICE_NAME=Tomcat@VERSION_MAJOR@ -set PR_DISPLAYNAME=Apache Tomcat @VERSION_MAJOR@ +set DISPLAYNAME=Apache Tomcat @VERSION_MAJOR@ if "x%1x" == "xx" goto displayUsage set SERVICE_CMD=%1 @@ -85,7 +85,7 @@ if "x%1x" == "xx" goto checkServiceCmd if "x%1x" == "x/userx" goto runAsUser if "x%1x" == "x--userx" goto runAsUser set SERVICE_NAME=%1 -set PR_DISPLAYNAME=Apache Tomcat %1 +set DISPLAYNAME=Apache Tomcat %1 shift if "x%1x" == "xx" goto checkServiceCmd goto checkUser @@ -108,7 +108,11 @@ goto end :doRemove rem Remove the service -"%EXECUTABLE%" //DS//%SERVICE_NAME% +echo Removing the service '%SERVICE_NAME%' ... +echo Using CATALINA_BASE: "%CATALINA_BASE%" + +"%EXECUTABLE%" //DS//%SERVICE_NAME% ^ + --LogPath "%CATALINA_BASE%\logs" if not errorlevel 1 goto removed echo Failed removing '%SERVICE_NAME%' service goto end @@ -124,45 +128,38 @@ echo Using CATALINA_BASE: "%CATALINA_ echo Using JAVA_HOME: "%JAVA_HOME%" echo Using JRE_HOME: "%JRE_HOME%" -rem Use the environment variables as an example -rem Each command line option is prefixed with PR_ - -set PR_DESCRIPTION=Apache Tomcat @VERSION@ Server - http://tomcat.apache.org/ -set "PR_INSTALL=%EXECUTABLE%" -set "PR_LOGPATH=%CATALINA_BASE%\logs" -set "PR_CLASSPATH=%CATALINA_HOME%\bin\bootstrap.jar;%CATALINA_BASE%\bin\tomcat-juli.jar;%CATALINA_HOME%\bin\tomcat-juli.jar" rem Set the server jvm from JAVA_HOME -set "PR_JVM=%JRE_HOME%\bin\server\jvm.dll" -if exist "%PR_JVM%" goto foundJvm +set "JVM=%JRE_HOME%\bin\server\jvm.dll" +if exist "%JVM%" goto foundJvm rem Set the client jvm from JAVA_HOME -set "PR_JVM=%JRE_HOME%\bin\client\jvm.dll" -if exist "%PR_JVM%" goto foundJvm -set PR_JVM=auto -set PR_STDOUTPUT=auto -set PR_STDERROR=auto +set "JVM=%JRE_HOME%\bin\client\jvm.dll" +if exist "%JVM%" goto foundJvm +set JVM=auto :foundJvm -echo Using JVM: "%PR_JVM%" +echo Using JVM: "%JVM%" + "%EXECUTABLE%" //IS//%SERVICE_NAME% ^ + --Description "Apache Tomcat @VERSION@ Server - http://tomcat.apache.org/" ^ + --DisplayName "%DISPLAYNAME%" ^ + --Install "%EXECUTABLE%" ^ + --LogPath "%CATALINA_BASE%\logs" ^ + --StdOutput auto ^ + --StdError auto ^ + --Classpath "%CATALINA_HOME%\bin\bootstrap.jar;%CATALINA_BASE%\bin\tomcat-juli.jar;%CATALINA_HOME%\bin\tomcat-juli.jar" ^ + --Jvm "%JVM%" ^ + --StartMode jvm ^ + --StopMode jvm ^ --StartClass org.apache.catalina.startup.Bootstrap ^ --StopClass org.apache.catalina.startup.Bootstrap ^ --StartParams start ^ --StopParams stop ^ --JvmOptions "-Dcatalina.base=%CATALINA_BASE%;-Dcatalina.home=%CATALINA_HOME%;-Djava.endorsed.dirs=%CATALINA_HOME%\endorsed;-Djava.io.tmpdir=%CATALINA_BASE%\temp;-Djava.util.logging.manager=org.apache.juli.ClassLoaderLogManager;-Djava.util.logging.config.file=%CATALINA_BASE%\conf\logging.properties" ^ - --StartMode jvm ^ - --StopMode jvm ^ --JvmMs 128 ^ --JvmMx 256 if not errorlevel 1 goto installed echo Failed installing '%SERVICE_NAME%' service goto end :installed -rem Clear the environment variables. They are not needed any more. -set PR_DISPLAYNAME= -set PR_DESCRIPTION= -set PR_INSTALL= -set PR_LOGPATH= -set PR_CLASSPATH= -set PR_JVM= echo The service '%SERVICE_NAME%' has been installed. :end --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org