Set up tomcat to start automatically with the system under Linux (Ubuntu)

Source: Internet
Author: User

There's a lot of talk online, I just record a

1. Switch to the/etc/init.d/directory

2. sudo vim tomcat

3. Write the following in the open file

#!/bin/SH# Chkconfig:345  About Ten# Description:auto-starts tomcat#/etc/init.d/tomcat# Tomcat Auto-start# Sourcefunctionlibrary.#./etc/init.d/functions# source Networking configuration.#./etc/sysconfig/Networkretval=0Export Jre_home=/usr/share/jdk1.8/Jreexport catalina_home=/opt/source/apache-tomcat-8.0. +Export Catalina_base=/opt/source/apache-tomcat-8.0. +start () {if[-F $CATALINA _home/bin/startup.SH ];  Then            Echo$"starting Tomcat"$CATALINA _home/bin/startup.SHRETVAL=$?Echo "OK"return $RETVALfi}stop () {if[-F $CATALINA _home/bin/shutdown.SH ];  Then            Echo$"stopping Tomcat"$CATALINA _home/bin/shutdown.SHRETVAL=$?Sleep 1            PS-FWWU Tomcat |grepApache-tomcat|grep-Vgrep|grep-V PID |awk '{print $}'|Xargs Kill-9            Echo "OK"-# [$RETVAL-eq0] &&RM-f/var/lock/.. return $RETVALfi} Case " $" inchstart) Start; stop) stop;; Restart)Echo$"restaring Tomcat"         $0StopSleep 1         $0start;;*)        Echo$"Usage: $ {Start|stop|restart}"Exit1        ;;EsacExit $RETVAL

4. Sudo sysv-rc-conf open, find the Tomcat column, the place as shown in the fork in the hook, restart the system, and then open the localhost:8080, you can take effect

sudo sysv-rc-conf command attached

Set up tomcat to start automatically with the system under Linux (Ubuntu)

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.