recently studied Java under the Slackware. It's inconvenient to start the Tomcat manually every time. So suit wrote a script to run Tomcat automatically when it was powered on. using JDK1.5.6, installed under the/app/jdk1.5.0_06 directory, Tomcat is a zip version of 5.5.
| #!/bin/sh # #/etc/rc.d/rc.tomcat # # Start/stop/restart the tomcat server. # Tomcat_start () {if [-x/app/tomcat5.5/bin/startup.sh]; then echo starting Tomcat:/app/tomcat5.5/bin/startup. SH "/app/tomcat5.5/bin/startup.sh fi} tomcat_stop () {if [-x/app/tomcat5.5/bin/startup.sh]; then echo" Sto P Tomcat:/app/tomcat5.5/bin/shutdown.sh "/app/tomcat5.5/bin/shutdown.sh fi} tomcat_restart () {Tomcat_stop Slee P 2 Tomcat_start} case "$" in ' start ') tomcat_start;; ' Stop ') tomcat_stop;; ' Restart ') Tomcat_restart;; *) Tomcat_start Esac |
The script holds the path/ETC/RC.D/RC.TOMCAT. Note that you want to give execution permissions. Then add a sentence to the/etc/rc.d/rc.local file:/etc/rc.d/rc.tomcat executes the Rc.tomcat file every time the starter is started. The problem with starting up is that our Java path information was written in/etc/profile, such as:
| Java_home=/app/jdk1.5.0_06 classpath=.: $JAVA _home/lib: $JAVA _home/jre/lib path=.: $JAVA _home/bin: $JAVA _home/jre/ Bin: $PATH export java_home CLASSPATH PATH |
Users have to log in before the path information can take effect, so there is a manual can start Tomcat, but random start problems. Modify the Rc.tomcat's finger script and specify the JDK path for it.
| #!/bin/sh # #/etc/rc.d/rc.tomcat # Start/stop/restart the tomcat server. # JAV A_HOME=/APP/JDK1.5.0_06 Export java_home Tomcat_start () { if [-x/app/tomcat5.5/bin/startup.sh]; then ; echo "Starting tomcat: /app/tomcat5.5/bin/startup.sh" /app/tomcat5.5/bin/ startup.sh fi} Tomcat_stop () { if [-x/app/tomcat5.5/bin/startup.sh]; then Echo Stop tomcat: /app/tomcat5.5/bin/shutdown.sh " /app/tomcat5.5/bin/shutdown.sh fi} Tomcat_restart () { tomcat_stop sleep 2 tomcat_start} case "$" in ' start ') tomcat_s Tart ;; ' Stop ') tomcat_stop ;; ' Restart ') tomcat_restart ;; *) tomcat_start Esac |
very simple, just before the beginning of the script to add two lines of JAVA path information: java_home=/app/jdk1.5.0_06 export java_home again after the boot information: If not believe, ssh in Nmap. Straight to why there is a 8000 Http-alt port, please refer to my another article under Tomcat5.5 to open the remote debugging port, this remote port is not open by default.