Preparatory work:
Because Tomcat uses Java, you need to install the JDK and configure the Java environment variables. This part is no longer mentioned, and is not the focus of this article.
Method One, join/etc/rc.loal
[Email protected]:~# vim/etc/rc.loal
Add the following before exit 0:
/usr/local/apache-tomcat-7.0.54/bin/startup.sh
Method Two, create a service from the startup script
First of all, you have to write a tomcat.sh, the inside to achieve start, stop, restart and other operations. The contents of the file are as follows:
#!/bin/SH# # Description:auto-starts Tomcat # Processname:tomcat Case " $" inchstart)SH/usr/local/apache-tomcat-7.0. Wu/bin/startup.SH ;; Stop)SH/usr/local/apache-tomcat-7.0. Wu/bin/shutdown.SH ;; Restart)SH/usr/local/apache-tomcat-7.0. Wu/bin/shutdown.SH SH/usr/local/apache-tomcat-7.0. Wu/bin/startup.SH ;; status);; *) ;; EsacExit0
Then execute the following instructions to create the Tomcat as a service:
cd/etc/init.d update --add Tomcat2345 Tomcat on
Then you can do it by executing:
Service Tomcat Start
To start the service.
If you want to uninstall the service, execute the following command:
CD/ETC/INIT.D
update-rc.d-f Tomcat Remove
Ubuntu Setup Customization program boot up (Tomcat for example)