LINUX is configured to configure the system service

xiaoxiao2021-03-06  74

Modifying history 2004/10/10 shiny creation ========= 0. Introduction, I started using Tomcat for a long time, intermittently, and it is configured under Windows and Linux. More recently used more, mainly because RESIN has a service script that has been made under Linux. And Tomcat has been put down. Anyway, our app is temporarily running under two platforms. Take a closer look at Tomcat in these few days, I feel easy to do this, why not move? So the following work is completed. 1. Prepare my installation environment and the corresponding software version is: Redhat 9.0 (in principle, RH7, 8, 9, ES / AS2.1, 3), other Linux or FreeBSD did not tried); J2SDK-1_4_2_05-Linux-i586 .bin (java_home = / usr / local / java, if you should also modify if the following place) JAKARTA-TOMCAT-5.0.28.TAR.GZ (Catalina_Home = / usr / local / tomcat, if the following places should also be modified ) The installation process will not be described again. 2. Configure Tomcat to follow the steps that typically configure Tomcat under Linux. :) Be careful not to conflict with other used ports. Then according to the content in [1], the following command is as follows: $ CD $ CATALINA_HOME / BIN $ TAR XVFZ JSVC.TAR.GZ $ CD JSVC-Src $ ./configure --with-java = / usr / local / java $ make $ CP JSVC .. $ CD ..

Start Tomcat: $ CD $ CATALINA_HOME $ ./bin/jsvc -djava.endorsed.dirs =. / Common / endorsed -cp ./bin/bootstrap.jar / -outfile ./logs/catalina.out -ERRFILE. /logs/catalina.err / org.apache.catalina.Startup.bootstrap Using the browser to access http: // : , make sure that Tomcat has been launched. 3. Write the service script service feet is set to Tomcat5 (see 5.), of course, you can modify itself, as long as you don't reintegrate with the already served. The Tomcat5 is then copied to the /etc/init.d directory. # cd /etc/init.d# chkconfig --Add Tomcat5 # chkconfig tomcat5 on # /etc/init.d/tomcat5 stop # /etc/init.d/tomcat5 Start Using the browser to access http: // : < Port>, make sure that Tomcat has been launched. # rebootok! 4. Reference [1]. Tomcat 5.0 setup. (http://jakarta.apache.org/tomcat/tomcat-5.0-doc/setup.html)

5. Attach: Tomcat5 script content attention, some of which are modified according to the actual directory. #! / bin / sh #################################################################################################################################################################################################################################################################################################### ####################################################################################################################### , Version 2.0 (The "license"); # you may not use this file except in compliance with the license. # You may ketain a copy of the license at ## http://www.apache.org/licenses/license- 2.0 ## Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES oR CONDITIONS OF ANY KIND, either express or implied. # See the License for the Specific Language Governing Permissions and # limitations under the license. ############################################################################################################################################################################################################################################################### ##################################@####### 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: ## # ## That for tomcat-5.0.x (apache tomcat / 5.0) # # Tomcat5 this shell script takes Care of Starting and Stopping # Standalone Tomcat-5.0.x ## chkconfig: - 60 50 # description: Tomcat is a jsp server daemon. # Processname: tomcat5 # source function library .. /etc/rc.d/init.d/functions

# Adapt the following lines to your configurationJAVA_HOME = / usr / local / javaCATALINA_HOME = / usr / local / tomcatDAEMON_HOME = $ CATALINA_HOME / common / daemonTOMCAT_USER = rootTMP_DIR = / var / tmpCATALINA_OPTS = CLASSPATH = / $ JAVA_HOME / lib / tools.jar: / $ Catalina_home / bin / commons-daemon.jar: / $ catalina_home / bin / bootstrap.jarretval = 0Prog = "Tomcat5"

Case "$ 1" in start) # # start tomcat # $ catalina_home / bin / jsvc / -use $ tomcat_user / -home $ java_home / -dcatalina.home = $ catalina_home / -djava.io.tmpdir = $ tmp_dir / -outfile $ Catalina_home / logs / catalina.out / -errfile '& 1' / $ catalina_opts / -cp $ classpath / org.apache.catalina.startup.bootstrap # # to get a verbose jvm # -verbose / # to Get a debug of jsvc. # -debug /

echo -n $ "Starting $ PROG:" Retval = $? [$ RETVAL-EQ 0] && touch / var / limited echo ;;

STOP) # # stop tomcat # echo -n $ "stopping $ pROG:" PID = `cat / var / run / jsvc.pid` Kill $ PID RETVAL = $? [$ RETVAL-EQ 0] && RM / VAR / LOCK / Subsys / $ PROG Echo_suCcess Echo ;;

*) Echo $ "Usage: $ 0 {start | stop}" EXIT 1 ;; ESAC

EXIT $ RETVAL

转载请注明原文地址:https://www.9cbs.com/read-108486.html

New Post(0)