zhangbinmy 发表于 2017-2-14 08:03:41

weblogic管理脚本

start.sh

#!/usr/bin/bash
#
# start.sh
# @auth: zhoulin@lianchuang.com
#
SERVER_STATUS () {
serv_status=`ps -ef | grep weblogic | grep webapp | grep -v grep | grep $1 | wc -l`
if [ "$serv_status" -eq "1" ]; then
echo ""
else
echo ""
fi
}
adminserver="http://10.168.31.108:7001"
echo "================= NGBOSS WebLogic Server start console =================="
echo " a: start admin               "   `SERVER_STATUS AdminServer`
echo " p: start proxy               "   `SERVER_STATUS proxy`      
echo " 1: start ngboss                "   `SERVER_STATUS ngboss`
echo " 2: start chnlmanm            "   `SERVER_STATUS copmanm`
echo " 3: start copmanm               "   `SERVER_STATUS copmanm`
echo " 4: start custmanm            "   `SERVER_STATUS custmanm`
echo " 5: start resmanm               "   `SERVER_STATUS resmanm`
echo " 6: start salemanm            "   `SERVER_STATUS salemanm`
echo " 7: start statmanm            "   `SERVER_STATUS statmanm`
echo " 8: start sysmanm               "   `SERVER_STATUS sysmanm`
echo " 9: start saleserv            "   `SERVER_STATUS saleserv`
echo " q: to quit"
echo "========================================================================="
echo -n "Please select which server you want to start: "
read v_server
cd
cd ngadmindomain
case $v_server in
"a")
echo "starting admin server..."
nohup bin/startWebLogic.sh &
;;
"p")
echo "starting proxy server..."
nohup bin/startManagedWebLogic.sh proxy $adminserver &
;;
"1")
echo "starting ngboss server..."
nohup bin/startManagedWebLogic.sh ngboss $adminserver &
;;
"2")
echo "starting chnlmanm server..."
nohup bin/startManagedWebLogic.sh chnlmanm $adminserver &
;;
"3")
echo "starting copmanm server..."
nohup bin/startManagedWebLogic.sh copmanm $adminserver &
;;
"4")
echo "starting custmanm server..."
nohup bin/startManagedWebLogic.sh custmanm $adminserver &
;;
"5")
echo "starting resmanm server..."
nohup bin/startManagedWebLogic.sh resmanm $adminserver &
;;
"6")
echo "starting salemanm server..."
nohup bin/startManagedWebLogic.sh salemanm $adminserver &
;;
"7")
echo "starting statmanm server..."
nohup bin/startManagedWebLogic.sh statmanm $adminserver &
;;
"8")
echo "starting sysmanm server..."
nohup bin/startManagedWebLogic.sh sysmanm $adminserver &
;;
"9")
echo "starting saleserv server..."
nohup bin/startManagedWebLogic.sh saleserv $adminserver &
;;
*)
echo "you have not select any server to start yet!"
;;
esac
exit 0


stop.sh

#!/usr/bin/bash
#
# stop.sh
# @auth: zhoulin@lianchuang.com
#
SERVER_STATUS () {
serv_status=`ps -ef | grep weblogic | grep webapp | grep -v grep | grep $1 | wc -l`
if [ "$serv_status" -eq "1" ]; then
echo ""
else
echo ""
fi
}
echo "=============== NGBOSS WebLogic Server stop console =============="
echo " a:    stop admin                               " `SERVER_STATUS AdminServer`
echo " p:    stop proxy                               " `SERVER_STATUS proxy`
echo " 1:    stop ngboss                              " `SERVER_STATUS ngboss`
echo " 2:    stop chnlmanm                            " `SERVER_STATUS chnlmanm`
echo " 3:    stop copmanm                           " `SERVER_STATUS copmanm`
echo " 4:    stop custmanm                            " `SERVER_STATUS custmanm`
echo " 5:    stop resmanm                           " `SERVER_STATUS resmanm`
echo " 6:    stop salemanm                            " `SERVER_STATUS salemanm`
echo " 7:    stop statmanm                            " `SERVER_STATUS statmanm`
echo " 8:    stop sysmanm                           " `SERVER_STATUS sysmanm`
echo " 9:    stop saleserv                            " `SERVER_STATUS saleserv`
echo " 99:   stop all server except admin and proxy   "
echo " 100:stop all"
echo " q:   to quit"
echo "================================================================="
echo -n "Please select which server you want to stop: "
read v_server
case $v_server in
"a")
echo "stopping admin server..."
kill -9 `ps -ef | grep weblogic | grep -v grep | grep "AdminServer" | awk '{print $2}'`
;;
"p")
echo "stopping proxy server..."
kill -9 `ps -ef | grep weblogic | grep -v grep | grep "proxy" | awk '{print $2}'`
;;
"1")
echo "stopping ngboss server..."
kill -9 `ps -ef | grep weblogic | grep -v grep | grep "ngboss" | awk '{print $2}'`
;;
"2")
echo "stopping chnlmanm server..."
kill -9 `ps -ef | grep weblogic | grep -v grep | grep "chnlmanm" | awk '{print $2}'`
;;
"3")
echo "stopping copmanm server..."
kill -9 `ps -ef | grep weblogic | grep -v grep | grep "copmanm" | awk '{print $2}'`
;;
"4")
echo "stopping custmanm server..."
kill -9 `ps -ef | grep weblogic | grep -v grep | grep "custmanm" | awk '{print $2}'`
;;
"5")
echo "stopping resmanm server..."
kill -9 `ps -ef | grep weblogic | grep -v grep | grep "resmanm" | awk '{print $2}'`
;;
"6")
echo "stopping salemanm server..."
kill -9 `ps -ef | grep weblogic | grep -v grep | grep "salemanm" | awk '{print $2}'`
;;
"7")
echo "stopping statmanm server..."
kill -9 `ps -ef | grep weblogic | grep -v grep | grep "statmanm" | awk '{print $2}'`
;;
"8")
echo "stopping sysmanm server..."
kill -9 `ps -ef | grep weblogic | grep -v grep | grep "sysmanm" | awk '{print $2}'`
;;
"9")
echo "stopping saleserv server..."
kill -9 `ps -ef | grep weblogic | grep -v grep | grep "saleserv" | awk '{print $2}'`
;;
"99")
echo "stopping all server except AdminServer..."
kill -9 `ps -ef | grep weblogic | grep -v grep | grep -v "AdminServer" | grep -v "proxy" | awk '{print $2}'`
;;
"100")
echo "stopping all servers..."
kill -9 `ps -ef | grep weblogic | grep -v grep | awk '{print $2}'`
;;
*)
echo "you have not select any server to stop yet!"
;;
esac
exit 0
页: [1]
查看完整版本: weblogic管理脚本