springboot jar 后台运行 sh
2017-09-06 15:47
302 查看
本文通过创建.sh文件启动jar,并在后台运行。
假如需要运行的jar为
business-callpush-1.1.jar,系统linux centos6.9
1、新建一个文件夹callpush
2、在callpush上新建bin目录
3、将business-callpush-1.1.jar移到bin下
4、在callpush目录下创建软连接
ln -s bin/business-callpush-1.1.jar callpush
5、callpush下创建start.sh stop.sh
start.sh:内容如下
#!/bin/sh
rm -f tpid
nohup java -jar callpush &
echo $!
> tpid
echo Start Success!
stop.sh内容如下:
#!/bin/sh
APP_NAME=callpush
tpid=`ps -ef|grep $APP_NAME|grep -v grep|grep -v kill|awk '{print $2}'`
if [ ${tpid} ]; then
echo 'Stop Process...'
kill -15 $tpid
fi
sleep 5
tpid=`ps -ef|grep $APP_NAME|grep -v grep|grep -v kill|awk '{print $2}'`
if [ ${tpid} ]; then
echo 'Kill Process!'
kill -9 $tpid
else
echo 'Stop Success!'
fi
6、改变start.sh stop.sh属性 为可执行 chmod 770 start.sh chmod 770 stop.sh
7、运行start.sh启动
8、运行stop.sh停止
假如需要运行的jar为
business-callpush-1.1.jar,系统linux centos6.9
1、新建一个文件夹callpush
2、在callpush上新建bin目录
3、将business-callpush-1.1.jar移到bin下
4、在callpush目录下创建软连接
ln -s bin/business-callpush-1.1.jar callpush
5、callpush下创建start.sh stop.sh
start.sh:内容如下
#!/bin/sh
rm -f tpid
nohup java -jar callpush &
echo $!
> tpid
echo Start Success!
stop.sh内容如下:
#!/bin/sh
APP_NAME=callpush
tpid=`ps -ef|grep $APP_NAME|grep -v grep|grep -v kill|awk '{print $2}'`
if [ ${tpid} ]; then
echo 'Stop Process...'
kill -15 $tpid
fi
sleep 5
tpid=`ps -ef|grep $APP_NAME|grep -v grep|grep -v kill|awk '{print $2}'`
if [ ${tpid} ]; then
echo 'Kill Process!'
kill -9 $tpid
else
echo 'Stop Success!'
fi
6、改变start.sh stop.sh属性 为可执行 chmod 770 start.sh chmod 770 stop.sh
7、运行start.sh启动
8、运行stop.sh停止
相关文章推荐
- 部署spring-boot工程jar包使其在后台运行
- SpringBoot打包jar包并后台运行
- spring boot jar 进程自动停止,自动终止,不能后台持续运行
- JAR(Spring Boot)应用的后台运行配置
- Spring Boot 以 jar 包方式运行在后台
- Spring Boot 以 jar 包方式运行在后台
- Spring Boot 以 jar 包方式运行在后台
- Spring Boot 以 jar 包方式运行在后台
- Spring boot jar 后台运行
- Spring boot jar 后台运行
- Spring boot jar 后台运行
- Spring boot jar 后台运行
- spring boot 支持jar包运行jsp
- 关于用-jar运行springboot项目遇到的两个问题
- SpringBoot打war包并部署到外部tomcat运行(jar工程改造为正war工程)
- spring boot spring cloud 打成jar包在Windows或者Linux上运行的几种方式
- Spring Boot学习总结(5)——SpringBoot Jar应用Linux后台部署执行
- SpringBoot基础-用 jar的方式运行springboot项目
- Spring Boot应用的后台运行配置
- IDEA Gradle 打包 Spring Boot 1.5x 可运行的jar文件流程