Run with a normal user
It is safer to deploy a service with a normal user
1001 for new password:passwd:all authentication Tokens updated Successfully.
switch to Tomcat to execute [[email protected] application]# chown-R tomcat:tomcat/application/Jdk[[email protected] application]# chown-R tomcat:tomcat/application/tomcat/[email protected] application]# su-Tomcat [[email protected]-node1 ~]$ cd/application/tomcat/bin/[[Email protected]-node1 bin]$ sh startup.sh #启动脚本Using catalina_base:/application/tomcatusing catalina_home:/application/tomcatusing Catalina_tmpdir:/application/tomcat/tempusing jre_home:/application/jdkusing CLASSPATH:/application/tomcat/bin/bootstrap.jar:/application/tomcat/bin/tomcat-Juli.jartomcat started.
[[Email protected]node1 tomcat]$ pwd/application/Tomcat[[email protected]-node1 tomcat]$ LS-Ltotal -drwxr-xr-x5Tomcat Tomcat4096Apr9 -: -BINDRWXR-xr-x6Tomcat Tomcat4096Apr8 Ten: theCONFDRWXR-xr-x2Tomcat Tomcat4096Apr8 to: theLib-rw-r--r--1Tomcat Tomcat57011Sep - -LICENSEDRWXR-xr-x2Tomcat Tomcat4096Apr9 -: thelogs-rw-r--r--1Tomcat Tomcat1444Sep - -NOTICE-rw-r--r--1Tomcat Tomcat6741Sep - -release-NOTES-rw-r--r--1Tomcat Tomcat16204Sep - -RUNNING.TXTDRWXR-xr-x2Tomcat Tomcat inApr8 to: theTemp DRWXR-xr-x8Tomcat Tomcat108Apr8 the: -WEBAPPSDRWXR-xr-x3Tomcat Tomcat +Apr8 to: -Work
The temporary files and working files are placed in temp and work when they are started, and they are recommended to be emptied each time they are started at the time of production.
Tomcat uses its own scripts sometimes to kill the process, write a script
#!/bin/Shjava_home=/application/Jdkcatalina_home=/application/Tomcatusage () {echo"$ {Start|stop|restart}"Exit1}[ $# -ne1]&&Usagestart_tomcat () {$CATALINA _home/bin/Startup.sh}stop_tomcat () {TPID=$ (Ps-aux|grep java|grep Tomcat|awk'{print $}') Kill-9$TPIDsleep5; Tstat=$ (Ps-aux|grep java|grep Tomcat|awk'{print $}')if[ -z $TSTAT];then echo"Tomcat Stop"ElseKill-9$TSTATfi} Case$1 inchstart) start_tomcat;; stop) Stop_tomcat;; Restart) Stop_tomcat Sleep5start_tomcat;;*) usage;; Esac
[[Email protected] ~]$ sh tomcat.sh tomcat.sh {start|stop| Restart} [Email protected]-node1 ~]$ sh tomcat.sh startusing catalina_base: /application/tomcatusing Catalina_home: /application//application/tomcat/tempusing jre_home: /application /jdkusing CLASSPATH: /application/tomcat/bin/bootstrap.jar:/application/tomcat/bin/tomcat- Juli.jartomcat started.
The default listener is port 8080.
[Email protected] ~]$ netstat-ntpl|grep java (not all processes could is identified, non-owned process info is not being shown, you would has to be the root to see it all.) TCP60 0:::8009:::* LISTEN4220/Java TCP60 0:::8080:::* LISTEN4220/Java TCP60 0 127.0.0.1:8005:::* LISTEN4220/java
Java Enterprise Application Tomcat Combat (ii)