echo "*****************Ess開始升級****************************"
curDate=`date '+%Y%m%d'`
cp ./applications/xxxx.ear ./applications/xxxx.ear.back${curDate}
#檢查升級程式包是否已上傳
if [[ -f ./upload/xxxx.ear ]];then
echo "*****************要升級的xxxx.ear已上傳*****************"
else
echo "*****************要升級的xxxx.ear尚未上傳,程式退出*****************"
exit
fi;
if [[ -f ./applications/xxxx.ear.back${curDate} ]];then
echo "*****************檔案備份成功****************************"
#停掉服務
counter=`ps -ef | grep wvpntest_peidw | grep -v grep | wc -l`
if [ "$counter" -eq 0 ] ; then
echo "*****************沒有wvpntest_peidw進程在運行*****************"
else
kill -9 `ps -ef|grep wvpntest_peidw |grep -v grep|awk '{print $2}'`
echo "*****************服務停止成功****************************"
fi
#刪除服務
rm ./applications/xxxx.ear;
echo "*****************xxxx.ear刪除成功***************************"
#部署新的xxxx.ear
mv ./upload/xxxx.ear ./applications/
if [[ -f ./applications/xxxx.ear ]];then
echo "*****************新xxxx.ear部署成功***********************"
counter=`ps -ef | grep wvpntest_peidw | grep -v grep | wc -l`
if [ "$counter" -eq 0 ] ; then
nohup startWebLogic.sh &
echo "*****************wvpntest_peidw啟動成功***********************"
else
echo "*****************警告,wvpntest_peidw已運行*******************"
fi
fi
else
echo "*****************檔案備份失敗,程式退出****************************"
fi