自动发版工具以及本地debug

# 定义变量
$jarFile = "xxx.jar"
$server = "ip"
$username = "user"
$password = "password"
$remoteHost = "${username}@${server}"
$remoteFolderPath = "path"
$gitDir = "$PSScriptRoot\..\.git"
# 设置环境变量 GIT_DIR
$env:GIT_DIR = $gitDir
git pull
mvn clean package -DskipTests -f $PSScriptRoot/pom.xml -s D:\settings-tianti-mall.xml
# 上传ZIP文件到远程服务器
& pscp -l $username -pw $password "$PSScriptRoot/target/$jarFile" "${remoteHost}:${remoteFolderPath}"

# 执行远程命令
plink.exe -l $username -pw $password $server -batch "cd $remoteFolderPath  &&  bash stop.sh $jarFile && bash start.sh $jarFile"

俺不是很懂,这个是组内一个同事写的脚本,可以执行脚本然后自动上传本地代码,
执行

>powershell
> .\deploy.ps1

执行命令powershell,然后打开powershell,然后执行对应脚本
在这里插入图片描述
这是对应的三个脚本
三个脚本内容分别是
remote

-agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=50055

start.sh

nohup java -jar $1> nohup.out 2>&1 &

stop.sh

rm -rf logs/ nohup.out
ps -ef|grep $1 |grep -v grep|grep -v bash |awk '{print $2}'|xargs kill -9

这个remote是用来本地开启debug,可以本地debug远程服务器代码

bash stop.sh xx.jar 
nohup java $(cat remote) -jar xx.jar &
  • 2
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

又是重名了

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值