首页 > 代码库 > linux 代码更新-打包-重启脚本

linux 代码更新-打包-重启脚本

#! /bin/sh

base=/home/project/myblog

cd $base


git pull


if [ ! $? -eq 0 ]
then
    echo "Error in git pull!!! Stop deployment!"
    exit 1
fi

cd $base
#查看服务器状态
HTTP_CODE=`curl -o /dev/null -s -w "%{http_code}" "http://localhost"`

echo "HTTP_CODE:"${HTTP_CODE}

if [ ${HTTP_CODE} -eq 200 ] then echo "server is running , began to close the server" curl -u admin:123456 -X POST http://localhost:8081/projectShutdown else echo "server is closed" fi echo "begin package the project" mvn clean package -Dmaven.test.skip=true cd $base/target echo "maven package project success, start server" java -jar myblog-0.0.1.jar

 

linux 代码更新-打包-重启脚本