Tomcat starts can be implemented with independent JSVC: JSVC is originally to download Commons-Daemon-1.0-alpha from http://jakarta.apache.org, but Tomcat has taken one, there is one in the Tomcat / bin directory. JSVC.TAR.GZ decompression, compile: #tar -xzvf jsvc.tar.gz # cd JSVC-SRC run #SH support / buildconf.sh #. / configure --with-java = / usr / java # make (Note: The JSVC source code with Tomcat-5.0.18 has a low-level error - less semicolons, which will cause compilation unsuccessful, can add this semicolon to the JSVC-SRC / Native directory of Tomcat yourself, there are two Script tomcat.sh and tomcat5.sh, can be used as a script that starts and stop Tomcat, I will be slightly modified, the files are as follows: Code: ^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^ #! / bin / sh # ## CHKCONFIG: 345 87 13 # Description: Tomcat daemon # processname: JSVC # pidfile: /var/run/jsvc.pid () CONFIG: ## source function library. . / Etc/rc.d/init.d/functions#prog=tomcat## small shell script to show how to start / stop tomcat using jsvc # if you want to have tomcat running on port 80 please modify the server.xml # File: ## # # port = "80" minprocessors = "5" maxprocessors = "75" # enablelookups = "true" redirectport = "8443" # acceptcount = "10" debug = "0" ConnectionTimeout = "60000" /> ## You NEED A Developement Version of Tomcat (apache tomcat / 4.1-dev) ## adapt the folowing lines to your configuration # Set your own parameter java_home = / usr / local / J2SDK1.4.2-04Catalina_Home = / usr / local / jakarta-Tomcat-5.0.19daemon_Home = $ catalina_home / bin # Need to set a no-permissive # user to run, this is more secure Tomcat_user = Tomcat5tmp_Dir = / var / tmpcatalina_opts = ClassPath = / $ java_home / lib / Tools.jar: / $ catalina_home / bin / commons-daemon.jar: / $ catalina_home / bin / bootstrap.jarstart () {echo -n $ "Starting $ PROG:"
# # Start Tomcat # $ daemon_home / jsvc-src / jsvc / -use $ tomcat_user / -home $ java_home / -dcatalina.home = $ catalina_home / -djava.io.tmpdir = $ tmp_dir / -outfile $ catalina_home / logs / catalina .out / -rrfile '& 1' / $ catalina_opts / -cp $ classpath / org.apache.catalina.startup.bootstrap # # to get a verbose jvm # -verbose / # to get a debug of jsvc. # -debug / return = $? [$ RETVAL = 0] && touch / var / lock / subsys / jsvc [$ RETVAL = 0] && echo_success || echo_failure echo return $ raval} stop () {echo -n $ "Stopping $ PROG:" # # 帖子 =?? $ Pid = `cat / var / run / jsvc.pid` Kill $ PID RETVAL = $? [$ RETVAL = 0] && rm / var / limited Echo_failure echo return $ retral} case "$ 1" in start) start ;; stop) stop ;; rest | reload) stop start ;; * Echo "USAGE $ 0 start / stop" exit 1 ;; esac ^^^^^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Tomcat uses --List to see if the system has Tomcat boot file #ckhconfig --List to automatically start with the system service to start with the system. This script will start automatically in Runlevel 3/4/5. Note that this script is created for Tomcat5. If you use Tomcat4, you will need to modify it on another Tomcat.sh.