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?