Ubuntu Setup Customization program boot up (Tomcat for example)

Source: Internet
Author: User

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)

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.