栏目分类:
子分类:
返回
名师互学网用户登录
快速导航关闭
当前搜索
当前分类
子分类
实用工具
热门搜索
名师互学网 > IT > 系统运维 > 运维 > Linux

linux自动拉取码云springboot并打包启动半自动脚本方式

Linux 更新时间: 发布时间: IT归档 最新发布 模块sitemap 名妆网 法律咨询 聚返吧 英语巴士网 伯小乐 网商动力

linux自动拉取码云springboot并打包启动半自动脚本方式

卸载重装git

git --version

yum remove git

yum -y install git

配置git

git config --global user.name "******"

git config --global user.email "******@126.com"

生成秘钥

ssh-keygen

将公钥文件内容填入码云(头像=》设置=》安全设置=》SSH公钥=》添加)

/root/.ssh/id_rsa.pub


下载maven

​https://dlcdn.apache.org/maven/maven-3/3.8.3/binaries/apache-maven-3.8.3-bin.zip

unzip apache-maven-3.8.3-bin.zip

安装maven

vi /etc/profile

export MAVEN_HOME=/usrapache-maven-3.8.3
export PATH=$PATH:$MAVEN_HOME/bin

:wq!

source /etc/profile

mvn -v

下载git代码

mkdir git

cd git

git clone git@gitee.com:*******.git

ll -al

git pull origin master

创建脚本

vi deploy.sh

#!/bin/bash
echo 进入项目目录
cd /usrgit/me-server/w4me
echo 拉取最新代码
git pull origin master
echo 关闭老线程
echo $(ps -ef | grep w4me | grep -v grep)
echo $(ps -ef | grep w4me | grep -v grep | awk '{print $2}')
pid=$(ps -ef | grep w4me | grep -v grep | awk '{print $2}')
if [ -n "$pid" ]
then
echo kill -9 $pid
kill -9 $pid
fi
echo 打包启动新线程
mvn clean package -Dmaven.test.skip=true
cp -R /usrgit/me-server/w4me/target/w4me.jar /usrspringboot
nohup java -jar /usrspringboot/w4me.jar --spring.profiles.active=preview &

:wq!

chmod -R 777 ./deploy.sh

部署

./deploy.sh

转载请注明:文章转载自 www.mshxw.com
本文地址:https://www.mshxw.com/it/467478.html
我们一直用心在做
关于我们 文章归档 网站地图 联系我们

版权所有 (c)2021-2022 MSHXW.COM

ICP备案号:晋ICP备2021003244-6号