-
run.sh
shell#!/bin/bash cd /home/java_projects/yh_oa_api/ nohup java -jar yh_oa_api.jar --spring.profiles.active=dev --server.port=9023 > /dev/null 2>&1 & echo "yh_oa_api.jar run successfully!"
-
stop.sh
shell#!/bin/bash echo "search [yh_oa_api.jar] process ......" pid=`ps -ef | grep "yh_oa_api.jar" | grep -v grep | awk '{print $2}'` if [[ pid>0 ]]; then echo "Process [ yh_oa_api.jar ] is runing , PID = $pid ;" echo "Now Will Kill Process PID = $pid ;" result=`kill -9 $pid` else echo "Process [ yh_oa_api.jar ] stop success! ;" fi
-
restart.sh
shell#!/bin/bash source /etc/profile # 要发布的jar包名称 NEW_JAR='yh_oa_api.jar' # 停止正在运行的jar包 pid=`ps -ef|grep $NEW_JAR| grep -v grep| awk '{print $2}'` echo "部署前的pid进程 :$pid" # 关闭已经启动的jar进程 if [ -n "$pid" ] then kill -9 $pid else echo "进程没有启动" fi # cd到jar包目录 cd /home/java_projects/yh_oa_api # 启动 nohup java -agentpath:/tmp/cdbg_java_agent.so -jar $NEW_JAR --spring.profiles.active=dev --server.port=9023 >/dev/null 2>&1 & echo "脚本执行完毕" pid=`ps -ef|grep $NEW_JAR | grep -v grep | awk '{print $2}'` # 检验进程是否启动 if [ -n "$pid" ] then echo "部署后的pid进程 :$pid" echo "启动成功" else echo "进程没有启动" fi
linux脚本启动jar包
ihgry2024-02-15 21:21
相关推荐
小筱在线3 小时前
在SpringCloud中实现服务间链路追踪计算机学姐3 小时前
基于SpringBoot+Vue的高校门禁管理系统大熊程序猿3 小时前
go 安装依赖超时计算机学姐4 小时前
基于SpringBoot+Vue的宠物医院管理系统JosieBook5 小时前
【.NET全栈】ASP.NET实战—基于ASP.NET的求职系统设计与实现customer085 小时前
【开源免费】基于SpringBoot+Vue.JS教师工作量管理系统(JAVA毕业设计)AskHarries5 小时前
Spring Boot集成LangChain来实现Rag应用黄俊懿5 小时前
【深入理解SpringCloud微服务】了解微服务的熔断、限流、降级,手写实现一个微服务熔断限流器Xua30556 小时前
浅谈Spring Cloud:OpenFeign蓝染-惣右介7 小时前
【若依RuoYi-Vue | 项目实战】帝可得后台管理系统(二)