How to set automatic restart for tomcat in windows

Source: Internet
Author: User
Tags goto tomcat server

Set automatic restart for green tomcat in windows

To download tomcat, you must download the bin \ service.batfile and the tomcat.exe file.

First, tomcat startup. bat in F: \ apache-tomcat-6.0.36 \ bin can be automatically started. To start tomcat, you need to configure two environment variables.

A) AVA_HOME: F: \ cds \ jdk1.5.0 _ 09 (jdk location)

B) CATALINA_HOME: F: \ cds \ apache-tomcat-6.0.36 (tomcat location, startup is to start tomcat at this location)

There is a bin \ service. bat tomcat6.0.36 Green Edition, if there is no service. bat can download the attachment and change the service. to edit the file, find JvmMs 128 -- JvmMx 256 and add Startup = auto (there is a space in front)

Now tomcat is located at F: \ cds \ apache-tomcat-6.0.36

 

Run F: \ cds \ apache-tomcat-6.0.36 \ bin \ service in the cmd window. bat enters the tomcat bin directory F: cd xxx \ apache-tomcat-6.0.36 \ bin to execute the command service for installing the service. bat install xxxservice. If the name is incorrect,

Continue to run service. bat remove xxxservicejin to delete it, and rename service. bat install imeta.

In this way, the service starts every time the computer restarts.

END

Notes

If the error "java heap space (memory overflow)" is reported, run: atat6w.exe // ES // tomcat6 in the command. tomcat6 indicates the name of the windows service you have installed, A tomcat server is displayed. Click java to modify the initial value and maximum value.


Set tomcat automatic restart in windows


Modify the catalina. bat file in the bin directory. The red part of the code is the modified content.

: DoStart

Shift

If not "% OS %" = "Windows_NT" goto noTitle

Set _ EXECJAVA = % _ RUNJAVA % (original content set _ EXECJAVA = start "Tomcat" % _ RUNJAVA %)

Goto gotTitle

: NoTitle

Set _ EXECJAVA = start % _ RUNJAVA %

: GotTitle

If not "" % 1 "" = ""-security "" goto execCmd

Shift

Echo Using Security Manager

Set SECURITY_POLICY_FILE = % CATALINA_BASE % \ conf \ catalina. policy

Goto execCmd

 

: DoStop

Shift

Set ACTION = stop

Goto execCmd

 

: ExecCmd

Rem Get remaining unshifted command line arguments and save them in

Set pai_line_args =

: SetArgs

If "% 1" "=" goto doneSetArgs

Set CMD_LINE_ARGS = % CMD_LINE_ARGS % 1

Shift

Goto setArgs

: DoneSetArgs

: Homeloop

Rem Execute Java with the applicable properties

If not "% JPDA %" = "" goto doJpda

If not "% SECURITY_POLICY_FILE %" = "" goto doSecurity

% _ EXECJAVA % JAVA_OPTS % CATALINA_OPTS % DEBUG_OPTS %-Djava. endorsed. dirs = "% JAVA_ENDORSED_DIRS %"-classpath "% CLASSPATH %"-Dcatalina. base = "% CATALINA_BASE %"-Dcatalina. home = "% CATALINA_HOME %"-Djava. io. tmpdir = "% CATALINA_TMPDIR %" % MAINCLASS % CMD_LINE_ARGS % ACTION %

Goto end

: DoSecurity

% _ EXECJAVA % JAVA_OPTS % CATALINA_OPTS % DEBUG_OPTS %-Djava. endorsed. dirs = "% JAVA_ENDORSED_DIRS %"-classpath "% CLASSPATH %"-Djava. security. manager-Djava. security. policy = "% SECURITY_POLICY_FILE %"-Dcatalina. base = "% CATALINA_BASE %"-Dcatalina. home = "% CATALINA_HOME %"-Djava. io. tmpdir = "% CATALINA_TMPDIR %" % MAINCLASS % CMD_LINE_ARGS % ACTION %

Goto end

: DoJpda

If not "% SECURITY_POLICY_FILE %" = "" goto doSecurityJpda

% _ EXECJAVA % JAVA_OPTS % CATALINA_OPTS %-Xdebug-Xrunjdwp: transport = % JPDA_TRANSPORT %, address = % JPDA_ADDRESS %, server = y, suspend = n % DEBUG_OPTS %-Djava. endorsed. dirs = "% JAVA_ENDORSED_DIRS %"-classpath "% CLASSPATH %"-Dcatalina. base = "% CATALINA_BASE %"-Dcatalina. home = "% CATALINA_HOME %"-Djava. io. tmpdir = "% CATALINA_TMPDIR %" % MAINCLASS % CMD_LINE_ARGS % ACTION %

Goto end

: DoSecurityJpda

% _ EXECJAVA % JAVA_OPTS % CATALINA_OPTS %-Xrunjdwp: transport = % JPDA_TRANSPORT %, address = % JPDA_ADDRESS %, server = y, suspend = n % DEBUG_OPTS %-Djava. endorsed. dirs = "% JAVA_ENDORSED_DIRS %"-classpath "% CLASSPATH %"-Djava. security. manager-Djava. security. policy = "% SECURITY_POLICY_FILE %"-Dcatalina. base = "% CATALINA_BASE %"-Dcatalina. home = "% CATALINA_HOME %"-Djava. io. tmpdir = "% CATALINA_TMPDIR %" % MAINCLASS % CMD_LINE_ARGS % ACTION %

Goto end

 

: End

 

Goto homeloop

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.