springboot -- jar 包启动/ 杀死进程/ 停止进程

springboot ,jar 包启动与杀死进程、停止进程

========================================================

jar启动

关闭窗口会停止运行,
如:ctrl+c 会停止运行

java -jar shareniu.jar
  • 1

Jar后台启动

nohup 表示后台运行,不会打印信息
log.txt 为日志文件

nohup java -jar shareniu.jar >log.txt &
  • 1

关闭后台运行的 jar 程序,方法一

直接杀死进程(根据端口)

sudo fuser -k -n tcp 8080    
  • 1

关闭后台运行的 jar 程序,方法二

根据pid 停止运行
1、找到pid

ps aux|grep wargame-0.0.1-SNAPSHOT.jar  
  • 1

2、根据pid关闭

kill -9  pid
原文地址:https://www.cnblogs.com/telwanggs/p/14041362.html