The program self-launch script is essentially a shell script. As an example of a simple Tomcat self-starter script, Tomcat uses the startup.sh in the installation directory to start, shutdown.sh stop, and we can write them into a startup script.
1. Create a self-starter script:
Vim/etc/init.d/tomcat
Enter the following content:
1#!/bin/Bash2 #3# Tomcat Startup script forThe Tomcat server4 #5# chkconfig:345 80 206 # Description:start the tomcat Deamon7 #8 # Source Function library9. /etc/rc.d/init.d/functionsTen Oneprog=Tomcat Ajava_home=/home/jdk1.7.0 - Export Java_home -catalana_home=/home/Tomcat the Export Catalina_home - - Case"$"inch - start) +echo "Starting Tomcat ..." -$CATALANA _home/bin/startup.sh + ;; A at stop) -echo "Stopping Tomcat ..." -$CATALANA _home/bin/shutdown.sh - ;; - - restart) inecho "Stopping Tomcat ..." -$CATALANA _home/bin/shutdown.sh toSleep 2 + Echo -echo "Starting Tomcat ..." the$CATALANA _home/bin/startup.sh * ;; $ Panax Notoginseng*) -echo "Usage: $prog {Start|stop|restart}" the ;; + Esac AExit 0
Enter/etc/init.d/to give executable permissions to the Tomcat script that you just created chmod a+x Tomcat
2. Add the startup script to boot Chkconfig tomcat on and reboot the server tomcat automatically started.
This is the start of the Tomcat boot implementation!
Linux Server booting up tomcat