#!/bin/sh #Copy jar to target path
BUILD_ID=DONTKILLME #后台执行
pid=$(ps -ef|grep pedia-qa.jar|grep -v grep | awk '{print $2}')
#copy jar 到启动目录 #cp -r /var/lib/jenkins/workspace/demo/demo/target/demo.jar /home/jar/demo
# 关闭已经启动的jar进程 function stop(){ if [ -n "$pid" ] then echo "pid进程 :$pid" kill -9 $pid else echo "进程没有启动" fi } stop
sleep 5s
#发布jar服务 function start(){ cd /opt/hanke/pedia-qa nohup /usr/java/jdk1.8/bin/java -jar pedia-qa.jar --spring.profiles.active=test --server.port=8081 >pedia-qa.log 2>&1 & }
start
|