weblogic开机启动脚本
1、在/home/bea/startBeaAll目录内创建一个startBeaAll.sh文件,加入如下内容(把相应目录与命令修改即可,红字部分为修改地方):
#!/bin/sh
echo "======weblogic start begin========"
echo "======managerServer start begin========"
managerid=`ps auxww|grep managerServer|grep -v grep|awk ‘{print $2}‘`
if [ -n "$managerid" ];
then
echo "======managerServer is start ,to kill the managerServer managerid $managerid========"
kill -9 $managerid
sleep 10
echo "====== the weblogic managerServer start========"
cd /home/bea/user_projects/domains/managerdomain/bin
nohup ./startWebLogic.sh > /home/bea/logs/manager.log &
#/home/bea/logs/manager.log &为日志存放位置,下同
else
echo "======managerServer is not start, the weblogic managerServer start========"
cd /home/bea/user_projects/domains/managerdomain/bin
nohup ./startWebLogic.sh > /home/bea/logs/manager.log &
fi
sleep 30
echo "======managerServer start end========"
echo "======appServer1 start begin========"
apponeid=`ps auxww|grep appServer1|grep -v grep|awk ‘{print $2}‘`
if [ -n "$apponeid" ]; then
echo "======appServer1 is start ,to kill the appServer1 apponeid $apponeid========"
kill -9 $apponeid
sleep 5
echo "====== the weblogic appServer1 start========"
cd /home/bea/user_projects/domains/managerdomain/bin
nohup ./startManagedWebLogic.sh appServer1 http://192.168.100.102:7001 > /home/bea/logs/app1.log &
else
echo "======appServer1 is not start, the weblogic appServer1 start========"
cd /home/bea/user_projects/domains/managerdomain/bin
nohup ./startManagedWebLogic.sh appServer1 http://192.168.100.102:7001 > /home/bea/logs/app1.log &
fi
sleep 120
echo "======appServer1 start end========"
echo "======appServer2 start begin========"
apptwoid=`ps auxww|grep appServer2|grep -v grep|awk ‘{print $2}‘`
if [ -n "$apptwoid" ]; then
echo "======appServer2 is start ,to kill the appServer2 apptwoid $apptwoid========"
kill -9 $apptwoid
sleep 5
echo "====== the weblogic appServer2 start========"
cd /home/bea/user_projects/domains/managerdomain/bin
nohup ./startManagedWebLogic.sh appServer2 http://192.168.100.102:7001 > /home/bea/logs/app2.log &
else
echo "======appServer2 is not start, the weblogic appServer2 start========"
cd /home/bea/user_projects/domains/managerdomain/bin
nohup ./startManagedWebLogic.sh appServer2 http://192.168.100.102:7001 > /home/bea/logs/app2.log &
fi
sleep 120
echo "======appServer2 start end========"
echo "======appServer3 start begin========"
appthrd=`ps auxww|grep appServer3|grep -v grep|awk ‘{print $2}‘`
if [ -n "$appthrid" ]; then
echo "======appServer3 is start ,to kill the appServer3 appthrid $appthrid========"
kill -9 $appthrid
sleep 5
echo "====== the weblogic appServer3 start========"
cd /home/bea/user_projects/domains/managerdomain/bin
nohup ./startManagedWebLogic.sh appServer3 http://192.168.100.102:7001 > /home/bea/logs/app3.log &
else
echo "======appServer3 is not start, the weblogic appServer3 start========"
cd /home/bea/user_projects/domains/managerdomain/bin
nohup ./startManagedWebLogic.sh appServer3 http://192.168.100.102:7001 > /home/bea/logs/app3.log &
fi
sleep 120
echo "======appServer3 start end========"
echo "======appServer4 start begin========"
appforid=`ps auxww|grep appServer4|grep -v grep|awk ‘{print $2}‘`
if [ -n "$appforid" ]; then
echo "======appServer4 is start ,to kill the appServer4 appforid $appforid========"
kill -9 $appforid
sleep 5
echo "====== the weblogic appServer4 start========"
cd /home/bea/user_projects/domains/managerdomain/bin
nohup ./startManagedWebLogic.sh appServer4 http://192.168.100.102:7001 > /home/bea/logs/app4.log &
else
echo "======appServer4 is not start, the weblogic appServer4 start========"
cd /home/bea/user_projects/domains/managerdomain/bin
nohup ./startManagedWebLogic.sh appServer4 http://192.168.100.102:7001 > /home/bea/logs/app4.log &
fi
sleep 120
echo "======appServer4 start end========"
sleep 5
echo "======weblogic start end========"
2、修改/etc/rc.local配置文件
在/etc/rc.local中加入如下内容: #vi /etc/rc.local
su - root -c "/home/bea/startBeaAll/startBeaAll.sh start "
郑重声明:本站内容如果来自互联网及其他传播媒体,其版权均属原媒体及文章作者所有。转载目的在于传递更多信息及用于网络分享,并不代表本站赞同其观点和对其真实性负责,也不构成任何其他建议。