Linux Setup Tomcat Quick Start mode

Source: Internet
Author: User

After building tomcat under Linux, each boot and shutdown goes to Tomcat's Bin directory for execution./startup.sh and./shutdown.sh

This is inconvenient, here's how to start, close, and restart Tomcat like the LS MV CP command

The first step to create a script

Script Creation Path/etc/init.d/tomcat

First execute: Vim/etc/init.d/tomcat the following content according to your own situation (modify/usr/tomcat/apache-tomcat-8.5.23/bin for your Tomcat path) d remove y copy p paste
#!/bin/bash    # Description:start or stop the Tomcat    # Usage:        Tomcat [Start|stop|restart]    #    Export Path= $PATH: $HOME/bin  export bash_env= $HOME/.bashrc  export username= "root" Case    "$" in  start)  #startup the Tomcat    cd/usr/tomcat/apache-tomcat-8.5.23/bin./startup.sh  ;;  Stop)  # stop Tomcat    cd/usr/tomcat/apache-tomcat-8.5.23/bin./shutdown.sh  echo "Tomcat stoped"  ;;  restart)  $ stop $  start  ;  *)  echo "Tomcat:usage:tomcat [Start|stop|restart]"  exit 1  Esac  exit 0  

Add Execute Permissions

chmod +x/etc/init.d/tomcat

Create a soft link

Cd/usr/bin

Ln-s/etc/init.d/tomcat

Test

Tomcat start

Tomcat stop

Tomcat restart

Linux Setup Tomcat Quick Start mode

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.