91超碰碰碰碰久久久久久综合_超碰av人澡人澡人澡人澡人掠_国产黄大片在线观看画质优化_txt小说免费全本

溫馨提示×

溫馨提示×

您好,登錄后才能下訂單哦!

密碼登錄×
登錄注冊×
其他方式登錄
點擊 登錄注冊 即表示同意《億速云用戶服務條款》

shell腳本之發布

發布時間:2020-08-01 22:27:04 來源:網絡 閱讀:143 作者:lxqyx 欄目:系統運維
#!/bin/bash
PATH=/application/jdk/bin:/application/jdk/jre/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/root/bin
REMOTE=/home/qroot/shangxian
LOCAL_HOST=/home/qroot/shangxian
LOG_CDATE='date "+%Y-%m-%d"'
LOG_CTIME='date "+%H:%M:%S"'

CDATE=$(date "+%Y-%m-%d")
CTIME=$(date "+%H-%M-%S")

SHELL_NAME="deployment_bigdata.sh"
SHELL_DIR="/home/qroot"
SHELL_LOG="${SHELL_DIR}/${SHELL_NAME}.log"

LOCK_FILE="/tmp/deploy_bigdata.lock"

#mkdir -p /home/qroot/shangxian/bigdata/{new_word,old_word,tmp,formal,config/{nginx,replace}}

usage(){
echo "USAGE:$0 AGE{bigdata [bigdata.tar.gz]|10.28.53.{192,223}] }"
}

shell_lock(){
    touch $LOCK_FILE
}

shell_unlock(){
    rm -f $LOCK_FILE
}

writelog(){
    LOGINFO=$1
    echo "${LOG_CDATE} ${LOG_CTIME}: ${SHELL_NAME} : ${LOGINFO} " >> ${SHELL_LOG}
}

tq_tomcat_docker(){
sudo sh -x /application/tomcat/bin/shutdown.sh
PD_1=$(sudo ps -ef|grep '/application/tomcat/bin'|grep -v 'grep'|wc -l)
sleep 30
if [ ${PD_1} -gt 0 ] 
then
PID_1=$(sudo ps -ef|grep '/application/tomcat/bin'|grep -v 'grep'|awk 'NR==1{print $2}')
sudo kill -9 ${PID_1}
fi
sleep 5 

sudo mkdir -p /application/tomcat/old_logs/logs_${CDATE}
sudo mv /application/tomcat/logs/* /application/tomcat/old_logs/logs_${CDATE}/
cd /application/tomcat/work/Catalina/ && sudo rm -fr *
sudo su - tomcat -c "sh /application/tomcat/bin/startup.sh"
}

docker_bigdata_scp() {
    writelog "docker_bigdata_scp"
[ ! -d ${LOCAL_HOST}/bigdata/new_word ] && echo  "${LOCAL_HOST}/bigdata/new_word ---bucunzai" && exit 16 
   if [ -f "${LOCAL_HOST}/bigdata/new_word/${1}" ]
    then
        echo "$(ls ${LOCAL_HOST}/bigdata/new_word/${1})"  

    mv ${LOCAL_HOST}/bigdata/new_word/${1} ${LOCAL_HOST}/bigdata/new_word/bigdata_"$CDATE"-${CTIME}.war || exit 16
        if [ -f "${LOCAL_HOST}/bigdata/new_word/bigdata_"$CDATE"-${CTIME}.war" ]
          then
            echo "$(ls ${LOCAL_HOST}/bigdata/new_word/bigdata_"$CDATE"-${CTIME}.war)"
          else
            echo "bigdata_"$CDATE"-${CTIME}.war -- File does not exist" && exit 11
        fi
    else
        echo "${1}--File does not exist" && exit 10
   fi
}

docker_bigdata_tar() {
        writelog "docker_bigdata_tar"
    PD_1=$(ls ${REMOTE}/bigdata/new_word/bigdata_"$CDATE"-${CTIME}.war 2>/dev/null|wc -l)
    if [ ${PD_1} -ne 0 ]
       then
        cd /application/tomcat/web_tmp/ && sudo rm -fr *
        sudo unzip ${LOCAL_HOST}/bigdata/new_word/bigdata_"$CDATE"-${CTIME}.war -d /application/tomcat/web_tmp/bigdata_"$CDATE"-${CTIME}
        mv ${REMOTE}/bigdata/new_word/bigdata_"$CDATE"-${CTIME}.war ${REMOTE}/bigdata/old_word/
        cd ${REMOTE}/bigdata/new_word/ && sudo rm -fr *
        cd /application/tomcat/webapps/ && sudo rm -fr *
        sudo ln -s /application/tomcat/web_tmp/bigdata_"$CDATE"-${CTIME} /application/tomcat/webapps/bigdata_new
                sudo chmod -R +x  /application/tomcat/webapps/bigdata_new/* 
                sudo chown -R tomcat.tomcat /application/tomcat
                sudo chown -R tomcat.tomcat /application/tomcat/*
        sudo chmod -R +x /application/tomcat/webapps/bigdata/WEB-INF/classes/com/*
       else
        echo ${1}-bigdata_"$CDATE"-${CTIME}.war -- File does not exist && exit 12
    fi
}

replace_config() {
    writelog "config"
    PD_2=$(ls ${REMOTE}/bigdata/config/replace/bigdata/* 2>/dev/null|wc -l)
    if [ ${PD_2} -gt 0 ]
    then
        sudo \cp ${REMOTE}/bigdata/config/replace/bigdata/* /application/tomcat/webapps/bigdata_new/WEB-INF/classes/config/db/
    else
        echo "replace===$(ls ${REMOTE}/bigdata/config/replace/* 2>/dev/null|wc -l)"
    fi
}

huizong(){
 if [ -f $LOCK_FILE ];then
   echo "Deploy is running" && exit;
 fi
TAR_NAME=${2}
CASE=${1}
case "${CASE}" in
   bigdata)
    shell_lock
    docker_bigdata_scp ${TAR_NAME} 
    sleep 10
    docker_bigdata_tar 
    sleep 10
    replace_config
    sleep 10
    tq_tomcat_docker
    shell_unlock
;;
*)
    usage
        exit 3
esac
}

mian(){
CMD_1=$1
CMD_2=$2
huizong $CMD_1 $CMD_2 
}

mian ${1}  ${2}
向AI問一下細節

免責聲明:本站發布的內容(圖片、視頻和文字)以原創、轉載和分享為主,文章觀點不代表本網站立場,如果涉及侵權請聯系站長郵箱:is@yisu.com進行舉報,并提供相關證據,一經查實,將立刻刪除涉嫌侵權內容。

AI

安徽省| 竹北市| 钟山县| 新绛县| 九江市| 和顺县| 江陵县| 浦东新区| 南汇区| 姜堰市| 赫章县| 武鸣县| 喀喇沁旗| 兴安县| 海兴县| 临武县| 南陵县| 睢宁县| 雅江县| 平潭县| 天气| 论坛| 北宁市| 保山市| 成都市| 沙河市| 夏津县| 宜阳县| 周宁县| 克什克腾旗| 黄冈市| 平和县| 平谷区| 奉节县| 赤峰市| 芒康县| 无为县| 陕西省| 龙口市| 洱源县| 苍南县|