Set tomcat to boot in linux

Source: Internet
Author: User

Set tomcat to boot in linux

#! /Bin/bashexport JAVA_HOME =/usr/lib/jdk/jdk1.7.0 _ 72WEBROOT_PATH =/home/zhengze/workspaceWEBSERVER_PATH = $ WEBROOT_PATH/web-server/apache-tomcat-6.0.41STARTUP_SHELL = $ WEBSERVER_PATH/bin/startup. shSHUTDOWN_SHELL = $ WEBSERVER_PATH/bin/shutdown. shcase "$1" instart) sh $ STARTUP_SHELL; stop) sh $ SHUTDOWN_SHELL; restart) sh $ SHUTDOWN_SHELLsh $ STARTUP_SHELL; esac

1. Create the tomcat. sh file and write the above content to the document. Set JAVA_HOME and WEBSERVER_PATH based on actual conditions.

2. cp tomcat. sh/etc/init. d/tomcat

3. sudo sysv-rc-conf tomcat on

Check tomcat startup settings:

Directly in/etc/rcX. d, you can also find the tomcat startup Item starting with S.

Here we will talk more about it. The start item at the beginning of S indicates that the system is started, and the start item at K indicates that the system is not started.

4. If you want to cancel startup, sysv-rc-conf tomcat off

If you want to delete tomcat from the startup Item, sysv-rc-conf tomcat remove

5. Restart the machine.

Check whether tomcat is on the listening port:

Netstat-nltp | grep <tomcat port>

6. You can manage tomcat in the following ways.

Start:/etc/init. d/tomcat start

Close:/etc/init. d/tomcat stop

You no longer need to find startup. sh or catalina. sh in a directory at a level.

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.