Set tomcat to boot in linux
#! /Bin/bashexport JAVA_HOME =/usr/lib/jdk/jdk1.7.0 _ 72WEBROOT_PATH =/home/zhengze/workspaceWEBSERVER_PATH = $ WEBROOT_PATH/web-server/apache-tomcat-6.0.41STARTUP_SHELL = $ WEBSERVER_PATH/bin/startup. shSHUTDOWN_SHELL = $ WEBSERVER_PATH/bin/shutdown. shcase "$1" instart) sh $ STARTUP_SHELL; stop) sh $ SHUTDOWN_SHELL; restart) sh $ SHUTDOWN_SHELLsh $ STARTUP_SHELL; esac
1. Create the tomcat. sh file and write the above content to the document. Set JAVA_HOME and WEBSERVER_PATH based on actual conditions.
2. cp tomcat. sh/etc/init. d/tomcat
3. sudo sysv-rc-conf tomcat on
Check tomcat startup settings:
Directly in/etc/rcX. d, you can also find the tomcat startup Item starting with S.
Here we will talk more about it. The start item at the beginning of S indicates that the system is started, and the start item at K indicates that the system is not started.
4. If you want to cancel startup, sysv-rc-conf tomcat off
If you want to delete tomcat from the startup Item, sysv-rc-conf tomcat remove
5. Restart the machine.
Check whether tomcat is on the listening port:
Netstat-nltp | grep <tomcat port>
6. You can manage tomcat in the following ways.
Start:/etc/init. d/tomcat start
Close:/etc/init. d/tomcat stop
You no longer need to find startup. sh or catalina. sh in a directory at a level.