1. Prepare the environment
JDK 1.8
[root@izm5e2w1juq9pmq37ceyvbz ~]# java -version
java version "1.8.0_161"
Java(TM) SE Runtime Environment (build 1.8.0_161-b12)
Java HotSpot(TM) 64-Bit Server VM (build 25.161-b12, mixed mode)
[root@izm5e2w1juq9pmq37ceyvbz ~]#
Copy the code
2. Prepare the corresponding JAR or WAR package
[root@izm5e2w1juq9pmq37ceyvbz ~]# ll |grep '.war'
-rw-r--r--. 1 root root 257778665 Jun 8 12:28 mgeids-boot.war
[root@izm5e2w1juq9pmq37ceyvbz ~]#
Copy the code
3. Run Java or WAR packages under Linux
nohup java -jar mgeids-boot.war >/dev/null &
Copy the code
4, stop the background running programs
1. Query the corresponding PID of the program
[root@izm5e2w1juq9pmq37ceyvbz ~]# ps aux
USER PID %CPU %MEM VSZ RSS TTY STAT START TIME COMMAND
root 6759 12.3 19.9 3669148 775344 pts/0 Sl 12:55 1:01 java -jar mgeids-boot.war
Copy the code
2. Run the kill PID command to kill the process
[root@izm5e2w1juq9pmq37ceyvbz ~]# kill 6759
Copy the code