0
点赞
收藏
分享

微信扫一扫

自动化部署脚本

西街小学的王 2022-03-11 阅读 104

自动化部署流程**

deploy.sh

#!/bin/bash
basepath="/home/lijinze1/workspace/hot_news_crawler"
cd ${basepath}

function git_download()
{
    branch=$1
    git pull origin ${branch}
    tar zcvf ../hot_news_crawler.tar.gz ../hot_news_crawler --exclude .git --exclude .vscode --exclude .svn
    scp -r /home/lijinze1/workspace/hot_news_crawler.tar.gz search@p10701v.hulk.zzzc.qihoo.net:/home/search/ljz
} 

function remote_command()
{
    ssh search@p10701v.hulk.zzzc.qihoo.net "cd /home/search/ljz;sh deploy_online.sh" 
}

git_download "v2"
remote_command

该代码在开发机的workspace目录下。

#!/bin/bash
base_path="/home/search/ljz"

ps -ef |grep "main.py"|grep -v "grep"|awk '{print $2}'|xargs kill -9

rm -rf ${base_path}/hot_news_crawler.bak

mv ${base_path}/hot_news_crawler ${base_path}/hot_news_crawler.bak

tar zxvf ${base_path}/hot_news_crawler.tar.gz >> /dev/null

sh ${base_path}/hot_news_crawler/bin/superprocess.sh

该代码部署在线上环境中。

举报

相关推荐

0 条评论