Hans, On Tue, Jul 28, 2020 at 5:51 AM Hans Schou <mir_h...@vd.dk> wrote:
> > > > Fra: Christopher Schultz <ch...@christopherschultz.net> > > > Seems like it would be kind of awesome to have a feature like //PS// > which would dump-out the service as a .BAT file, like: > > > C:> tomcat9w.exe //PS//my-service-name > > Yes, that would be great. > And with JAVA_HOME also. > > Right now I have solved my upgrade task with a script which can only > upgrade from Tomcat 8.5 to 9.0 > As I can not see from command line which tomcat are being used, I had to > look that up first. > Then I also have to check if the instance is running Java 8 or Java 11. > I run tomcat8w.exe to get and set Java options and memory usage. > > Here is the script: > > IF [%1] == [] ( > ECHO Error > EXIT /B > ) > SET INSTANCE=%1 > SET JAVA_HOME=D:\Java\jdk1.8 > rem SET JAVA_HOME=D:\Java\jdk11 > SET CATALINA_HOME=D:\Apache\tomcat-8.5 > SET CATALINA_BASE=D:\tomcat\%INSTANCE% > %CATALINA_HOME%\bin\tomcat8w.exe //ES//%INSTANCE% > PAUSE > "C:\Program Files (x86)\Notepad++\notepad++.exe" > %CATALINA_BASE%\conf\server.xml > PAUSE > NET STOP %INSTANCE% > CALL %CATALINA_HOME%\bin\service remove %INSTANCE% > SET CATALINA_HOME=D:\Apache\tomcat-9.0 > CALL %CATALINA_HOME%\bin\service install %INSTANCE% > %CATALINA_HOME%\bin\tomcat9.exe //US//%INSTANCE% ^ > --Startup auto ^ > --DisplayName "Apache Tomcat 9.0 %INSTANCE%" ^ > --Description "Tomcat 9.0 %CATALINA_BASE% %CATALINA_HOME%" > PAUSE > NET START %INSTANCE% > %CATALINA_HOME%\bin\tomcat9w.exe //ES//%INSTANCE% > > You should be able to set the Java Options with service.bat. There is an Environment variable called JvmArgs [1] which is appended to JvmOptions and allows you to add different Java Options, e.g. set it like so before calling `service.bat install`: set "JvmArgs=-Dsome.property=SomeValue;-XX:+HeapDumpOnOutOfMemoryError" For the heap size set the JvmMs and JvmMx environment variables. Igal [1] https://github.com/apache/tomcat/blob/master/bin/service.bat#L228 > Best regards > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org > For additional commands, e-mail: users-h...@tomcat.apache.org >