Jenkins+gitlab发布Django程序

Jenkins+gitlab发布Django程序

一、

 

 

二、

 

 

 

 

 

 

 

 

 

 

三、shell

 

# !/bin/bash
cd /root/upload_file

#git add .
#git commit -m 'other'
# git pull

if [ $mode == "deploy" ];then
    git add .
    git commit -m 'other'
    git checkout $branch
    git pull
    echo "**********************************************"
    echo ‘通过branch部署’
    echo "**********************************************"
else
    git add .
    git commit -m 'other'
    git reset --hard $tag
    echo "**********************************************"
     echo ‘通过tag部署’
    echo "**********************************************"
fi


PROCESS=`ps -e | grep gunicorn | awk '{printf "%d\n", $1}'`
for i in $PROCESS
do
    echo "Kill the gunicorn process [ $i ]"
    kill -9 $i
done


echo "finish kill"

sleep 3

nohup  /opt/python/bin/gunicorn  upload_pro.wsgi  -b  0.0.0.0:18000 -w 4  > /dev/null &

echo "New project start"

sleep 5

PROCESS=`ps -e | grep gunicorn | awk '{printf "%d\n", $1}'`
for i in $PROCESS
do
    echo "The new gunicorn process [ $i ]"
done

echo "success"

  

 

posted @ 2020-04-17 13:41  小学弟-  阅读(327)  评论(0)    收藏  举报