linuxプラットフォーム上のヒューマンマシンインタラクティブプロジェクト発表ツール

115662 ワード

1、需要説明
オンラインステップが煩雑で注意が多いプロジェクトでは、できるだけ人為的な現場操作コマンドを減らし、機械の自動化にオンライン機能を実現させることが特に重要である.
2、ツールの概要
ツールが起動すると、システムガイドに従って実行する(a)または指定された命令を入力して実行する(b)を選択するようユーザーに要求されます.
ステップ毎に簡単なユーザインタラクション(Y/N)を行った後、システムは自動的に確認後のコマンドを実行する
ツールには、sqlファイルの実行、アプリケーションのパブリッシュ、アプリケーションの起動(再起動)などの機能があります.
3、工具構造
プロジェクト名
       etc/
           sh/
               help.sh
               step.sh
               top.sh
               wrapper.sh
           const.lst
           dbinfo.cfg
           file.cfg
           func.cfg
           step.lst
           step_run.log
       log/
       source/
       tool/
             execSqlFile.sh
       run.sh
ディレクトリまたはファイルの説明:
etc/プロファイル格納ディレクトリ
etc/sh実行可能なshellスクリプト、例えばhelp.sh、出力ツールヘルプ情報;step.sh、プロジェクト配置手順情報を出力する.top.sh、プロジェクト配置タイトルを出力する.wrapper.sh、shellスクリプトのパッケージクラスをカスタマイズし、shellスクリプトのログ印刷などの前後動作を実現
   etc/const.lstツール定数ファイル
   etc/dbinfo.cfgデータベース接続情報
   etc/file.cfgすべてのファイルまたはディレクトリ定数ファイル
   etc/func.cfg共通関数
   step.lstプロジェクト配置手順リスト
   step_run.logステップ実行ログ、ログ内容はステップ名、実行状態(0成功1失敗)、開始時間、終了時間、時間(秒)を含む
log/ログディレクトリ
source/データファイル格納ディレクトリ
tool/ツールスクリプトは、execSqlFileなどのディレクトリを格納します.sh、sqlファイルを実行するための実行可能なsqlファイルパスパラメータを入力する
  run.shツール起動スクリプト
4、コード展示
run.sh
#!/bin/sh

cd `dirname $0`

#      
. ./etc/const.lst
. ./etc/dbinfo.cfg
. ./etc/file.cfg
. ./etc/func.cfg

function init {
    clear
    #    
    ./etc/sh/top.sh
    checkstatus $? "    "
    #      
    ./etc/sh/step.sh
    checkstatus $? "      "
}

init

if [ ! -f ${hkbaps_step_log} ]; then
    touch ${hkbaps_step_log}
fi

#      
declare -a array
declare -a code
declare -a cmd
cnt=0
while read line
do
if [[ -n `echo ${line}|grep -v "^\s*$"` ]] && [[ "${line:0:1}" != "#" ]]; then
    let cnt=cnt+1
    code[$cnt]="`lpad ${cnt} 3`"
    array[$cnt]="${code[$cnt]}-`echo ${line}|awk '{print $1}'`"
    cmd[$cnt]="`echo ${line}|awk '{print $2}'`"
fi
done < ${hkbaps_step}

valid=0
match=""
flag=1
index=1
#      

while true
do
read -r -p "                 (a)               (b)?  " inp
case $inp in
    [aA])
while true
do
    if [ ${valid} -eq 0 ]; then
        #              
        slog=`cat ${hkbaps_step_log}|grep -v "^\s*$"|tail -n 1`
        if [ -n "${slog}" ]; then
            step=`echo ${slog}|awk '{print $1}'`
            status=`echo ${slog}|awk '{print $2}'`
            if [ "${status}" == "1" ]; then
                match=${step}
                
                for((i=1;i));
                do   
                    if [ "${array[$i]}" == "${step}" ]; then
                        index=$i
                        flag=0
                        break
                    fi
                done
                
                if [ ${flag} -eq 1 ]; then
                    match=${step}
                fi
            else
                flag=0
            fi
        else
            flag=0    
        fi
    fi
    
    if [ ${flag} -eq 1 ]; then
        read -r -p "         :${match}             ,                    ?  " input
        case $input in
            [nN][oO]|[nN])
                output "     "
                exit 1
            ;;
            [uU][nN][dD][oO]|[uU])
                read -r -p "           ?  [Y/N] " input2
                case $input2 in
                    [yY][eE][sS]|[yY])
                        match=""
                        flag=0
                        index=1
                        valid=1
                        echo "" > ${hkbaps_step_log}
                    ;;
                    [nN][oO]|[nN])
                        output "     "
                        valid=1
                    ;;
                    [cC][lL][eE][aA][rR]|[cC])
                        init
                        valid=1
                    ;;
                    *)
                        valid=1
                        echo -e "        ${input},     !"
                    ;;
                esac
            ;;
            [sS][tT][eE][pP]|[sS])
                ./etc/sh/step.sh
            ;;
            [hH][eE][lL][pP]|[hH])
                ./etc/sh/help.sh
            ;;
            *)
                exists=0
                for((i=1;i));
                do   
                    tmp=`upper ${input}`
                    if [ "${tmp}" == "${code[${i}]}" ]; then
                        index=${i}
                        exists=1
                        break
                    fi
                done
                if [ ${exists} -eq 1 ]; then
                    ${hkbaps_step_wrapper} ${array[${index}]} ${cmd[${index}]}
                    valid=0
                    match=""
                    flag=0
                    let index=index+1
                else
                    valid=1
                echo -e "        ${input},     !"
                fi
            ;;
        esac
    else
        if [[ -n ${match} ]] && [[ ${index} -gt 1 ]]; then
            read -r -p "         :${match},      ?  [Y/N] " input
            case $input in
                [yY][eE][sS]|[yY])
                    ${hkbaps_step_wrapper} ${array[${index}]} ${cmd[${index}]}
                    valid=0
                    let index=index+1
                    match=""
                ;;
                [nN][oO]|[nN])
                    output "     "
                    exit 1
                ;;
                [uU][nN][dD][oO]|[uU])
                    read -r -p "           ?  [Y/N] " input2
                    case $input2 in
                        [yY][eE][sS]|[yY])
                            match=""
                            flag=0
                            index=1
                            valid=1
                            echo "" > ${hkbaps_step_log}
                        ;;
                        [nN][oO]|[nN])
                            valid=1
                            output "     "
                        ;;
                        *)
                            valid=1
                            echo -e "        ${input},     !"
                        ;;
                    esac
                ;;
                [sS][tT][eE][pP]|[sS])
                    valid=1
                    ./etc/sh/step.sh
                ;;
                [hH][eE][lL][pP]|[hH])
                    valid=1
                    ./etc/sh/help.sh
                ;;
                [cC][lL][eE][aA][rR]|[cC])
                    valid=1
                    init
                ;; 
                *)
                    valid=1
                    echo -e "        ${input},     !"
                ;;
            esac
        else
            while [ ${index} -lt ${#array[*]} ];
            do
                msg=${array[${index}]}
                slog=`cat ${hkbaps_step_log}|grep ${msg}|grep -v "^\s*$"|tail -n 1`
                if [ -n "${slog}" ]; then
                    status=`echo ${slog}|awk '{print $2}'`
                    if [ "${status}" == "0" ]; then
                        read -r -p "  :${msg}      ,           ? [Y/N] " input
                        case $input in
                            [yY][eE][sS]|[yY])
                                let index=index+1
                            ;;
                            [nN][oO]|[nN])
                                break
                            ;;
                            [uU][nN][dD][oO]|[uU])
                                read -r -p "           ?  [Y/N] " input2
                                case $input2 in
                                    [yY][eE][sS]|[yY])
                                        match=""
                                        flag=0
                                        index=1
                                        valid=1
                                        echo "" > ${hkbaps_step_log}
                                    ;;
                                    [nN][oO]|[nN])
                                        output "     "
                                        valid=1
                                    ;;
                                    *)
                                        valid=1
                                        echo -e "        ${input},     !"
                                    ;;
                                esac
                            ;;
                            [sS][tT][eE][pP]|[sS])
                                valid=1
                                ./etc/sh/step.sh
                            ;;
                            [hH][eE][lL][pP]|[hH])
                                valid=1
                                ./etc/sh/help.sh
                            ;;
                            [cC][lL][eE][aA][rR]|[cC])
                                valid=1
                                init
                            ;; 
                            *)
                                valid=1
                                echo -e "        ${input},     !"
                            ;;
                        esac
                    fi
                else
                    break
                fi
            done
            
            let t=index-1
            if [[ ${t} -gt 0 ]] && [[ ${index} -lt ${#array[*]} ]]; then
                msg=${array[${t}]}
                read -r -p "  :${msg}     ,            :${array[${index}]}? [Y/N] " input
                case $input in
                    [yY][eE][sS]|[yY])
                    ;;
                    [nN][oO]|[nN])
                        output "     "
                        exit 1
                    ;;
                    [uU][nN][dD][oO]|[uU])
                        read -r -p "           ?  [Y/N] " input2
                        case $input2 in
                            [yY][eE][sS]|[yY])
                                match=""
                                flag=0
                                index=1
                                valid=1
                                echo "" > ${hkbaps_step_log}
                            ;;
                            [nN][oO]|[nN])
                                output "     "
                                valid=1
                            ;;
                            *)
                                valid=1
                                echo -e "        ${input},     !"
                            ;;
                        esac
                    ;;
                    [sS][tT][eE][pP]|[sS])
                        valid=1
                        ./etc/sh/step.sh
                    ;;
                    [hH][eE][lL][pP]|[hH])
                        valid=1
                        ./etc/sh/help.sh
                    ;;
                    [cC][lL][eE][aA][rR]|[cC])
                        valid=1
                        init
                    ;; 
                    *)
                        valid=1
                        echo -e "        ${input},     !"
                    ;;
                esac
            fi
            if [ ${index} -lt ${#array[*]} ]; then
                if [ ${index} -eq 1 ]; then
                    msg=${array[${t}]}
                    read -r -p "  :${array[${index}]},        ? [Y/N] " input
                    case $input in
                        [yY][eE][sS]|[yY])
                        ;;
                        [nN][oO]|[nN])
                            output "     "
                            exit 1
                        ;;
                        [sS][tT][eE][pP]|[sS])
                            valid=2
                            ./etc/sh/step.sh
                        ;;
                        [hH][eE][lL][pP]|[hH])
                            valid=2
                            ./etc/sh/help.sh
                        ;;
                        [cC][lL][eE][aA][rR]|[cC])
                            valid=2
                            init
                        ;; 
                        *)
                            valid=2
                            echo -e "        ${input},     !"
                        ;;
                    esac
                fi
                if [ ${valid} -ne 2 ]; then
                    ${hkbaps_step_wrapper} ${array[${index}]} ${cmd[${index}]}
                    valid=0
                    let index=index+1
                    match=""
                fi
            else
                output ""
                exit 1
            fi
        fi
    fi

done
        
    ;;
    [bB])
    while true
    do
        read -r -p "" input
        case $input in
            [nN][oO]|[nN])
                output "     "
                exit 1
            ;;
            [sS][tT][eE][pP]|[sS])
                ./etc/sh/step.sh
            ;;
            [hH][eE][lL][pP]|[hH])
                ./etc/sh/help.sh
            ;;
            [cC][lL][eE][aA][rR]|[cC])
                init
            ;; 
            *)
                exists=0
                for((i=1;i));
                do   
                    tmp=`upper ${input}`
                    if [ "${tmp}" == "${code[${i}]}" ]; then
                        index=${i}
                        exists=1
                        break
                    fi
                done
                if [ ${exists} -eq 1 ]; then
                    ${hkbaps_step_wrapper} ${array[${index}]} ${cmd[${index}]}
                else
                    echo -e "        ${input},     !"
                fi
            ;;
        esac
    done
    ;;
    [nN][oO]|[nN])
        output "     "
        exit 1
    ;;
    [sS][tT][eE][pP]|[sS])
        ./etc/sh/step.sh
    ;;
    [hH][eE][lL][pP]|[hH])
        ./etc/sh/help.sh
    ;;
    [cC][lL][eE][aA][rR]|[cC])
        init
    ;; 
    *)
        echo -e "        ${input},     !"
    ;;
esac

done

etc/const.lst
sys_name=XXX  
sys_code=XXX
sys_task=    
sys_author=XXX
sys_user=XXX
sys_skin=[44\;37
LANG="zh_CN.GBK"
NLS_LANG="SIMPLIFIED CHINESE_CHINA.ZHS16GBK"

etc/dbinfo.cfg
db_dump_username=XXX
db_dump_uo_username=XXX

db_username=XXX
db_password=XXX
db_instance=XXX
db_link=${db_username}/${db_password}@${db_instance}

etc/file.cfg
#    
step=etc/step.lst

#      
step_log=etc/step_run.log

#       
step_wrapper=./etc/sh/wrapper.sh

#         
db_check_sql=source/env_db.sql

#         
db_check=./etc/sh/env_db.sh

#  01
check_01=source/check_01.sql
#  02
check_02=source/check_02.sql
#  03
check_03=source/check_03.sql

etc/func.cfg
#!/bin/sh

#    
export logfile=log/`date +%Y%m%d`.log

#info       
function output {
    msg=$1
    skin=$2
    if [ -f "${msg}" ]; then
        echo `date` >> ${logfile}
        cat ${msg} >> ${logfile}
        cat ${msg}
    else
        if [ -n "${skin}" ]; then
            echo -e "\033${skin}${msg}\033[0m"
           else
               echo -e ${msg}
        fi
        echo -e "`date` ${msg}" >> ${logfile}
    fi
}

function title {
    msg=$1
    skin=$2
    if [ -n "${skin}" ]; then
        echo -e "
\033${skin}\;1m${msg}\033[0m
" else echo -e "
\033[1m${msg}\033[0m
" fi echo -e "`date`
${msg}
" >> ${logfile} } function success { msg=$1 if [ ! -n "${msg}" ]; then msg= fi output ${msg} } function error { msg=$1 if [ ! -n "${msg}" ]; then msg= fi output ${msg} exit 1 } function checkstatus { code=$1 msg=$2 if [ ${code} -ne 0 ]; then output ${msg} :${code} exit 1 fi } function printchar { n=$1 c=$2 s="" if [ ! -n "${n}" ]; then n=20 fi if [ ! -n "${c}" ]; then c="_" fi for((i=1;i<=${n};i++)); do s="${s}${c}" done echo -e ${s} } function seperate { echo "" echo `printchar "-" 300` echo "" } function lpad { char=$1 len=$2 fill=$3 if [ -n "${char}" ]; then if [ ! -n "${len}" ]; then len=8 fi if [ ! -n "${fill}" ]; then fill="0" fi size=${#char} let m=len-size s="" for((i=1;i<=${m};i++)); do s="${s}${fill}" done echo ${s}${char} fi } function lower { msg=$1 if [ -n "${msg}" ]; then if [ -f "${msg}" ]; then cat ${msg}|tr A-Z a-z else echo ${msg}|tr A-Z a-z fi fi } function upper { msg=$1 if [ -n "${msg}" ]; then if [ -f "${msg}" ]; then cat ${msg}|tr a-z A-Z else echo ${msg}|tr a-z A-Z fi fi } # function checklog { reg=$1 log=$2 msg="" if [ ! -f "${log}" ]; then log=${logfile} msg=`cat ${log}|grep -i ${reg}` else msg=`cat ${logfile}|grep -i ${reg}` fi if [ ${#msg} -gt 0 ]; then echo " ${log}, :${msg}" exit 1 fi } function execSqlFile { dbconn=$1 dbfile=$2 err=$3 if [ ! -n "${dbconn}" ]; then error "" fi if [ ! -f "${dbfile}" ]; then error "sql ${dbfile} , " fi if [ ! -n "${err}" ]; then err=ORA- fi read -r -p " ${dbconn} sql ${dbfile}? [Y/N] " input case $input in [yY][eE][sS]|[yY]) sqlplus -S /nolog<<EOF conn ${dbconn} spool ${logfile} append @${dbfile} spool off quit EOF checklog ${err} ;; [nN][oO]|[nN]) echo " " ;; *) echo "Invalid input..." exit 1 ;; esac } function execDSqlFile { dbconn=$1 dbfile=$2 err=$3 if [ ! -n "${dbconn}" ]; then error "" fi if [ ! -f "${dbfile}" ]; then error "sql ${dbfile} , " fi if [ ! -n "${err}" ]; then err=ORA- fi sqlplus -S /nolog<<EOF conn ${dbconn} spool ${logfile} append @${dbfile} spool off quit EOF } function executeSql(){ dbconn=$1 sql=$2 err=$3 if [ ! -n "${dbconn}" ]; then error "" fi if [ ! -n "${sql}" ]; then error "sql ${sql} , " fi if [ -f "${sql}" ]; then sql=`cat ${sql}` fi lst=${sql: -1} if [ "${lst}" != ";" ]; then sql="${sql};" fi if [ ! -n "${err}" ]; then err=ORA- fi read -r -p " ${dbconn} sql :${sql}? [Y/N] " input case $input in [yY][eE][sS]|[yY]) sqlplus -S /nolog<<EOF conn ${dbconn} spool ${logfile} append ${sql} spool off quit EOF checklog ${err} ;; [nN][oO]|[nN]) echo " " ;; *) echo "Invalid input..." exit 1 ;; esac } function querySingle(){ dbconn=$1 sql=$2 err=$3 if [ ! -n "${dbconn}" ]; then error "" fi if [ ! -n "${sql}" ]; then error "sql ${sql} , " fi if [ -f "${sql}" ]; then sql=`cat ${sql}` fi lst=${sql: -1} if [ "${lst}" != ";" ]; then sql=${sql}; fi if [ ! -n "${err}" ]; then err=ORA- fi read -r -p " ${dbconn} sql :${sql}? [Y/N] " input case $input in [yY][eE][sS]|[yY]) result=`sqlplus -S /nolog<<EOF set heading off feedback off pagesize 0 verify off echo off conn ${dbconn} spool ${logfile} append ${sql} spool off quit EOF` checklog ${err} echo ${result} ;; [nN][oO]|[nN]) echo " " ;; *) echo "Invalid input..." exit 1 ;; esac } function impDump(){ dbconn=$1 file=$2 fromuser=$3 touser=$4 err=$5 if [ ! -n "${dbconn}" ]; then error "" fi if [ ! -f "${file}" ]; then error " dump ${file} , " fi if [ ! -n "${fromuser}" ]; then error "" fi if [ ! -n "${touser}" ]; then error "" fi if [ ! -n "${err}" ]; then err=ORA- fi read -r -p " ${dbconn} dump , :${file}, :${fromuser}, :${touser}? [Y/N] " input case $input in [yY][eE][sS]|[yY]) tmp="${logfile}.imp.`date +%H%M%S`" imp ${dbconn} file=${file} log=${tmp} STATISTICS=NONE data_only=y fromuser=${fromuser} touser=${touser} checklog ${err} ${tmp} ;; [nN][oO]|[nN]) echo " " ;; *) echo "Invalid input..." exit 1 ;; esac } function exportDump(){ dbconn=$1 file=$2 lst=$3 err=$4 if [ ! -n "${dbconn}" ]; then error "" fi if [ ! -n "${file}" ]; then error " dump , " fi if [ ! -f "${lst}" ]; then error " ${lst} , " fi if [ ! -n "${err}" ]; then err=ORA- fi read -r -p " ${dbconn} dump , :${file}, :`cat ${lst}`? [Y/N] " input case $input in [yY][eE][sS]|[yY]) tabs="" while read line do tabs="${tabs},`echo ${line}|awk '{print $1}'`" done < ${lst} if [ -n "${tabs}" ]; then tabs=${tabs:1} tmp="${logfile}.exp.`date +%H%M%S`" exp ${dbconn} file=${file} log=${tmp} tables=${tabs} checklog ${err} ${tmp} fi ;; [nN][oO]|[nN]) echo " " ;; *) echo "Invalid input..." exit 1 ;; esac }

etc/step.lst
                  ./etc/sh/env.sh
      (   )    ./etc/sh/app_startup.sh

etc/sh/help.sh
#!/bin/sh

#    
cd `dirname $0`
cd ../../

. ./etc/const.lst
. ./etc/file.cfg
. ./etc/func.cfg

output      "${sys_skin};1m"
output ""

output "a:          "
output "b:          "
output "c:     "
output "h:      "
output "n:      "
output "s:      "
output "u:    ( :           )"
output "y:        "

output ""

etc/sh/top.sh
#!/bin/sh

#         
cd `dirname $0`
cd ../../

. ./etc/const.lst
. ./etc/file.cfg
. ./etc/func.cfg

header=`printchar 30`
header="${header}${sys_name}(${sys_code}) - ${sys_task}${header}"
echo -e "\033${sys_skin};1m ${header}\033[0m\033${sys_skin};4m    :${sys_author}\033[0m"
echo ""

etc/sh/step.sh
#!/bin/sh

#        
cd `dirname $0`
cd ../../

. ./etc/const.lst
. ./etc/file.cfg
. ./etc/func.cfg

output      "${sys_skin};1m"

cnt=0
while read line
do
if [ -n "${line}" ] && [[ "${line:0:1}" != "#" ]]; then
    let cnt=cnt+1
    output ${cnt}、`lpad ${cnt} 3`-`echo ${line}|awk '{print $1}'`
fi
done < ${hkbaps_step}

output "
"

etc/sh/wrapper.sh
#!/bin/sh

#       
cd `dirname $0`
cd ../../

. ./etc/const.lst
. ./etc/file.cfg
. ./etc/func.cfg

step=$1
cmd=$2

if [ ! -n ${step} ]; then
    error "            ,   !"
elif [ ! -n ${cmd} ]; then
    error "    :${step}         ,   "
else
    output ""
    output ${step} "${sys_skin};1m"
    output ""
    bdate=`date +%Y%m%d%H%M%S`
    sh ${cmd}
    tmp=$?
    output ""
    edate=`date +%Y%m%d%H%M%S`
    cost=$(( edate-bdate ))
    result=""
    if [[ ${tmp} -ne 0 ]] || [[ ${msg} -ne 0 ]]; then
         result="${step}\t1\t${bdate}\t${edate}\t${cost}( )"
     else
       result="${step}\t0\t${bdate}\t${edate}\t${cost}( )"
    fi
    echo -e ${result} >> ${hkbaps_step_log}
    
fi

etc/sh/env_db.sh
#!/bin/sh

#       
cd `dirname $0`
cd ../../

. ./etc/const.lst
. ./etc/dbinfo.cfg
. ./etc/file.cfg
. ./etc/func.cfg

execDSqlFile ${db_link} ${hkbaps_db_check_sql}

etc/sh/app_startup.sh
#!/bin/sh

#      (   )
cd `dirname $0`
cd ../../

. ./etc/const.lst
. ./etc/file.cfg
. ./etc/func.cfg

export LANG=en_US.UTF-8
echo "LANG:$LANG"

u=`whoami`

if [ "${u}" != "${sys_user}" ]; then
    output "      ${u}      ${sys_user}  "
    read -r -p "      ${u}      ${sys_user}  ,          (  )  ? [Y/N] " input
    case $input in
        [yY][eE][sS]|[yY])
        ;;
        [nN][oO]|[nN])
            output "     "
            exit 1
        ;;
        *)
            echo -e "        ${input},     !"
        ;;
    esac
fi

#   

#  web    
web_log=`ps -ef|grep "Dcatalina.home=${app_web}"|grep -v grep`
if [ -n "${web_log}" ]; then
    sh ${app_web}/bin/shutdown.sh
fi

cnt=0
while [ ${cnt} -lt 3 ]
do
    web_log=`ps -ef|grep "Dcatalina.home=${app_web}"|grep -v grep`
    if [ -n "${web_log}" ]; then
        let cnt=cnt+1
        sleep 2
    else
        break
    fi
done

web_log=`ps -ef|grep "Dcatalina.home=${app_web}"|grep -v grep`
if [ -n "${web_log}" ]; then
    output ${web_log}
    progress=`echo ${web_log}|awk '{print $2}'`
    read -r -p "web          ,        -${progress}? [Y/N] " input
    case $input in
        [yY][eE][sS]|[yY])
            kill -9 ${progress}
        ;;
        [nN][oO]|[nN])
            output "     "
            exit 1
        ;;
        *)
            echo -e "        ${input},     !"
        ;;
    esac
fi

#  server    
server_log=`ps -ef|grep "Dcatalina.home=${app_server}"|grep -v grep`
if [ -n "${server_log}" ]; then
    sh ${app_server}/bin/shutdown.sh
fi

cnt=0
while [ ${cnt} -lt 3 ]
do
    server_log=`ps -ef|grep "Dcatalina.home=${app_server}"|grep -v grep`
    if [ -n "${server_log}" ]; then
        let cnt=cnt+1
        sleep 2
    else
        break
    fi
done

server_log=`ps -ef|grep "Dcatalina.home=${app_server}"|grep -v grep`
if [ -n "${server_log}" ]; then
    output ${server_log}
    progress=`echo ${server_log}|awk '{print $2}'`
    read -r -p "server          ,        -${progress}? [Y/N] " input
    case $input in
        [yY][eE][sS]|[yY])
            kill -9 ${progress}
        ;;
        [nN][oO]|[nN])
            output "     "
            exit 1
        ;;
        *)
            echo -e "        ${input},     !"
        ;;
    esac
fi

#   
sh ${app_server}/bin/startup.sh && sh ${app_web}/bin/startup.sh

cnt=0
while [ ${cnt} -lt 3 ]
do
    server_log=`ps -ef|grep "Dcatalina.home=${app_server}"|grep -v grep`
    if [ -n "${server_log}" ]; then
        progress=`echo ${server_log}|awk '{print $2}'`
        output "server        ,   :${progress}"
        break
    else
        let cnt=cnt+1
        sleep 2
    fi
done

cnt=0
while [ ${cnt} -lt 3 ]
do
    web_log=`ps -ef|grep "Dcatalina.home=${app_web}"|grep -v grep`
    if [ -n "${web_log}" ]; then
        progress=`echo ${web_log}|awk '{print $2}'`
        output "web        ,   :${progress}"
        break
    else
        let cnt=cnt+1
        sleep 2
    fi
done