Linux Tomcat quick Action

Source: Internet
Author: User

Linux shortcut launches Tomcat

1. Script Path/etc/init.d/tomcat

First execution: Vi/etc/init.d/tomcat

Press A to edit, the following content according to your own situation (mainly to modify the/usr/local/tomcat6/bin/)

After modifying the copy to the edit box, ESC exits the edit: Wq Save exit

Java code


# Description:start or stop the Tomcat

# Usage:tomcat [Start|stop|reload|restart]


Export path= $PATH: $HOME/bin

Export bash_env= $HOME/.BASHRC

Export Username= "root"

Case "$" in


#startup the Tomcat

Echo-n "Tomcat Start:"



echo "Tomcat started"

Tail-f/home/tomcat-bdcserver/logs/log.log# Print Log



# Stop Tomcat

Echo-n "Tomcat Stop:"

Ps-ef | grep "Java" | Grep-v grep | Sed ' s/[]*/:/g ' |cut-d:-f2| Kill-9 ' Cat '


RM-RF Catalina

echo "Tomcat stopped"



$ stop

$ start



echo "Usage: Tomcat [Start|stop|reload|restart]"

Exit 1


Exit 0

2. Change the tomcat script to an executable file

Java code

chmod +x/etc/init.d/tomcat

3. In order to execute this script on any path, it needs to be added to the/usr/bin directory

Java code

1.[[email protected]]# Cd/usr/bin

2. [Email protected]]# ln-s/etc/init.d/tomcat.

Linux Tomcat quick Action

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: 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.