In linux, tomcat is automatically started upon startup. Method 1: Modify Tomcat/bin/startup. sh: export JAVA_HOME =/home/java1.6.0 _ 27 export CLASSPATH = $ CLASSPATH: $ JAVA_HOME/lib/tools. jar: $ JAVA_HOME/lib/dt. jar :. export PATH = $ JAVA_HOME/bin: $ PATH export CATALINA_HOME =/home/tomcat/bin/catalina. sh start in/etc/rc. d/rc. add/home/tomcat/bin/startup to local. sh Method 2: 1. Save the following code as a tomcat file and make it an executable file chmod 755 tomcat. #! /Bin/bash #/etc/rc. d/init. d/tomcat # init script for tomcat precesses # processname: tomcat # description: tomcat is a j2ee server # chkconfig: 2345 86 16 # description: Start up the Tomcat servlet engine. if [-f/etc/init. d/functions]; then. /etc/init. d/functions elif [-f/etc/rc. d/init. d/functions]; then. /etc/rc. d/init. d/functions else echo-e "\ atomcat: unable to locate functions lib. Cannot continue. "exit-1 fi RETVAL =$? CATALINA_HOME = "/home/tomcat" case "$1" in start) if [-f $ CATALINA_HOME/bin/startup. sh]; then echo $ "Starting Tomcat" $ CATALINA_HOME/bin/startup. sh fi; stop) if [-f $ CATALINA_HOME/bin/shutdown. sh]; then echo $ "Stopping Tomcat" $ CATALINA_HOME/bin/shutdown. sh fi; *) echo $ "Usage: $0 {start | stop}" exit 1; esac exit $ RETVAL 2. Copy the tomcat file to/etc/init. d/, and run: chkconfig -- add tomcat 3, in tomcat/bin/ Catalina. add the following statement to the sh file: export JAVA_HOME =/home/jdk1.6.0 _ 27 export CATALINA_HOME =/home/tomcat export CATALINA_BASE =/home/tomcat export CATALINA_TMPDIR =/home/tomcat/temp test whether tomcat can start tomcat: service tomcat start test whether tomcat can stop tomcat: In service tomcat stop start mode, this service is started # chkconfig tomcat on # chkconfig -- list tomcat. Note: in the comments statement of the first two lines of the tomcat file, the chkconfig and description must be included (do not make spelling mistakes); otherwise The error message "tomcat service does not support chkconfig" appears when kconfig -- add tomcat. This line of chkconfig indicates the default startup running level and the priority of Start and Stop. if the service is not started at any running level by default, "-" is used instead of "Run level. For example, # chkconfig: 345 61 61 // The 345 parameter in this row indicates which running levels are started, and 345 indicates that tomcat scripts are started at runtime Levels 2, 3, 4, and 5, start sequence number (S61); close the description line of sequence number (K61) to describe the service. You can use "\" to annotate the service.