Set Tomcat startup in Ubuntu

Source: Internet
Author: User
Run the sudogedit/etc/init. d/tomcat6 command on Ubuntu to start Tomcat and copy the following English part. (Note the first sentence #! /Bin/sh is not a shell file if it is not written. Replace the corresponding jdk and tomcat with your own directory. #! /Bin/sh # description: Auto-startstomcat # processname: tom

Set Tomcat startup in Ubuntu

Run sudo gedit/etc/init. d/tomcat6

Copy the following English part. (Note the first sentence #! /Bin/sh is not a shell file if it is not written. Replace the corresponding jdk and tomcat with your own directory.

#! /Bin/sh
#
# Description: Auto-starts tomcat
# Processname: tomcat


Export JAVA_HOME =/opt/jre1.6.0 _ 33


Case $1 in
Start)
Sh/opt/tomcat6/bin/startup. sh
;;
Stop)
Sh/opt/tomcat6/bin/shutdown. sh
;;
Restart)
Sh/opt/tomcat6/bin/shutdown. sh
Sh/opt/tomcat6/bin/startup. sh
;;
Esac
Exit 0

After completing the preceding steps, run sudo chmod 755/etc/init. d/tomcat6 to make the file executable.
Then we need to make a link to enable the shell file to start automatically.
Sudo ln-s/etc/init. d/tomcat6/etc/rc1.d/K99tomcat6
Sudo ln-s/etc/init. d/tomcat6/etc/rc2.d/S99tomcat6
Run sudo/etc/init. d/tomcat7 start/stop/restart in the terminal (you can choose one of the three to start, stop, and restart the function)

Install a UBUNTU Service Management
Sudo apt-get install sysv-rc-conf

Use sysv-rc-conf
Sudo sysv-rc-conf

Find the added Tomcat 6 service and select Levels 2, 3, 4, and 5 to enable automatic startup.
Now it's all done. Restart the server to see if it can start automatically?

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.