备份老的jar包
d=`date +"%Y%m%d-%H%M%S"` cd /home/eccore/app/uat mv steward-api-3.0.0-SNAPSHOT.jar steward-api-3.0.0-SNAPSHOT-$d.jar
从windows向linux传输文件
cd C:WindowsSystem32 pscp.exe -l eccore -pw "!**密码**" -r "E:sonarworkspaceA网-客户管家项目-后台部署steward-api argetsteward-api-3.0.0-SNAPSHOT.jar" eccore@10.130.37.64:/home/eccore/app/uat
杀进程并启动
cd /home/eccore/app/uat ps -ef | grep java | grep -v grep | awk '{print $2}' | xargs kill -9 sh start.sh
start.sh内容如下
nohup /usr/local/java/jre/bin/java -jar /home/eccore/app/uat/steward-api-3.0.0-SNAPSHOT.jar --spring.profiles.active=uat --hostname=vmt10482-webapiuat -Xms256m -Xmx1024m --logging.level.root=debug >/dev/null 2>&1 &