這篇文章給大家分享的是有關(guān)linux中如何實(shí)現(xiàn)bash腳本監(jiān)控啟動(dòng)停止weblogic服務(wù)的內(nèi)容。小編覺(jué)得挺實(shí)用的,因此分享給大家做個(gè)參考,一起跟隨小編過(guò)來(lái)看看吧。
成都創(chuàng)新互聯(lián)公司專業(yè)為企業(yè)提供山東網(wǎng)站建設(shè)、山東做網(wǎng)站、山東網(wǎng)站設(shè)計(jì)、山東網(wǎng)站制作等企業(yè)網(wǎng)站建設(shè)、網(wǎng)頁(yè)設(shè)計(jì)與制作、山東企業(yè)網(wǎng)站模板建站服務(wù),10多年山東做網(wǎng)站經(jīng)驗(yàn),不只是建網(wǎng)站,更提供有價(jià)值的思路和整體網(wǎng)絡(luò)服務(wù)。有時(shí),linux系統(tǒng)需要做HA或者類似的功能,需要配置weblogic腳本來(lái)啟動(dòng),停止,查看狀態(tài),可以如下方式寫(xiě)
命令形式:Weblogic server start|stop|restart|status
### BEGIN WLS Configration DOMAIN_NAME=base_domain SERVER_NAME=AServer ADMIN_URL="t3://ip:7001" DOMAIN_PATH=/Oracle/Middleware/user_projects/domains/${DOMAIN_NAME} #使用這個(gè)命令得到weblogic對(duì)應(yīng)服務(wù)進(jìn)程的進(jìn)程號(hào) WLS_PID=`ps -ef|grep java|grep =${SERVER_NAME}|awk '{print $2}'` #USER_NAME=`logname` USER_NAME=`whoami` ## WLS_MEMORY USER_MEM_ARGS="-Xms2048m -Xmx3096m -XX:PermSize=256m -XX:MaxPermSize=512m" export USER_MEM_ARGS ### END WLS Configration ######### Weblogic server start|stop|restart|status #用于等待進(jìn)程啟停 wait_for_pid () { try=0 case "$1" in 'created') while test $try -lt 7 ; do printf . try=`expr $try + 1` sleep 1 done WLS_PID=`ps -ef|grep java|grep ${SERVER_NAME}|awk '{print $2}'` if [ "$WLS_PID" != "" ] ; then try='' fi ;; 'removed') while test $try -lt 35 ; do WLS_PID=`ps -ef|grep java|grep ${SERVER_NAME}|awk '{print $2}'` if [ "${WLS_PID}" = "" ] ; then try='' break fi printf . try=`expr $try + 1` sleep 1 done ;; esac } #判斷操作用戶名,不能是root需要使用weblogic用戶 if [ "$USER_NAME" = "root" ] ; then echo "USER_NAME is $USER_NAME! Plz use weblogic!" exit 1 fi #domain不能為空 if [ "$DOMAIN_NAME" = "" ] ; then echo "DOMAIN_NAME is not set! Plz set DOMAIN_NAME!" exit 1 fi #service不能為空 if [ "$SERVER_NAME" = "" ] ; then echo "SERVER_NAME is not set! Plz set SERVER_NAME!" exit 1 fi #url不能為空 if [ "$ADMIN_URL" = "" ] ; then echo "ADMIN_URL is not set! Using default ADMIN_URL!" fi #如果是查看狀態(tài)命令 if [ "$1" = "status" ] then if [ "${WLS_PID}" = "" ] ; then echo "No pid - $SERVER_NAME is not running !" exit 1 else echo "$SERVER_NAME is running !" exit 0 fi fi printf "Terminating $SERVER_NAME " if [ "${WLS_PID}" = "" ] ; then echo "No pid - $SERVER_NAME is not running !" else kill -9 $WLS_PID wait_for_pid removed if [ -n "$try" ] ; then echo " failed " exit 1 fi echo " done ! " exit 0 fi #如果是停止命令,這里不使用這個(gè) if [ "$1" = "stop" ] then echo "" else #啟動(dòng)命令 printf "Starting $SERVER_NAME " if echo $SERVER_NAME|grep -q dmin ; then nohup sh $DOMAIN_PATH/bin/startWebLogic.sh & else nohup sh $DOMAIN_PATH/bin/startManagedWebLogic.sh $SERVER_NAME $ADMIN_URL & fi wait_for_pid created if [ -n "$try" ] ; then echo " failed " exit 1 else echo " done ! " exit 0 fi fi echo "To check the log, you may excute:" echo "tail -100f "
感謝各位的閱讀!關(guān)于“l(fā)inux中如何實(shí)現(xiàn)bash腳本監(jiān)控啟動(dòng)停止weblogic服務(wù)”這篇文章就分享到這里了,希望以上內(nèi)容可以對(duì)大家有一定的幫助,讓大家可以學(xué)到更多知識(shí),如果覺(jué)得文章不錯(cuò),可以把它分享出去讓更多的人看到吧!
本文題目:linux中如何實(shí)現(xiàn)bash腳本監(jiān)控啟動(dòng)停止weblogic服務(wù)-創(chuàng)新互聯(lián)
文章路徑:http://jinyejixie.com/article0/dedpio.html
成都網(wǎng)站建設(shè)公司_創(chuàng)新互聯(lián),為您提供品牌網(wǎng)站建設(shè)、網(wǎng)站收錄、標(biāo)簽優(yōu)化、網(wǎng)站設(shè)計(jì)、網(wǎng)站內(nèi)鏈、外貿(mào)網(wǎng)站建設(shè)
聲明:本網(wǎng)站發(fā)布的內(nèi)容(圖片、視頻和文字)以用戶投稿、用戶轉(zhuǎn)載內(nèi)容為主,如果涉及侵權(quán)請(qǐng)盡快告知,我們將會(huì)在第一時(shí)間刪除。文章觀點(diǎn)不代表本網(wǎng)站立場(chǎng),如需處理請(qǐng)聯(lián)系客服。電話:028-86922220;郵箱:631063699@qq.com。內(nèi)容未經(jīng)允許不得轉(zhuǎn)載,或轉(zhuǎn)載時(shí)需注明來(lái)源: 創(chuàng)新互聯(lián)
猜你還喜歡下面的內(nèi)容