作为BI的开发人员,经常启停BI服务在所难免,启动的过程又比较长,命令需要不同目录切换,简直烦死人呢,
特意整理了linux中的启动脚本,将以下脚本存成biee.sh,后面的过程就相当简单了,
启动:./biee.sh start
停止 : ./biee.sh stop
重启:./biee restart
日志的观察:
tail -f /var/log/obiee-start.log
tail -f /var/log/obiee-stop.log
以下是脚本内容,保存成.sh文件,然后chmod +x 就可以了,希望对大家有用。
当然还想再懒点的话,可以将这个bash做成自动启动的服务即可。
#!/bin/bash
#
# 根据实际环境配置
# biee安装用户
BI_USER=biee
# biee安装目录
BI_HOME=/home/biee/MiddleWare
# biee管理员用户
BI_ADMIN=weblogic
# biee管理员密码
BIEE_ADMIN_PASSWD=weblogic123
# Domain名称
BIEE_DOMAIN=bifoundation_domain
# Instance名称
BIEE_INSTANCE=instance1
# Server名称
BIEE_SERVER=bi_server1
# Admin server URL (hostname:port)
BIEE_MANAGER_URL=dbserver:7001
# 以下信息不需要修改
WL_PATH=$BI_HOME/wlserver_10.3/server/bin
BIEE_PATH=$BI_HOME/user_projects/domains/$BIEE_DOMAIN/bin
ORACLE_INSTANCE=$BI_HOME/instances/$BIEE_INSTANCE
export ORACLE_INSTANCE
START_LOG=/var/log/obiee-start.log
STOP_LOG=/var/log/obiee-stop.log
SUBSYS=obiee
start() {
echo "********************************************************************************"
echo "Starting Admin Server on $(date)"
echo "********************************************************************************"
su $BI_USER -c "$BIEE_PATH/startWebLogic.sh -Dweblogic.management.username=$BI_ADMIN -Dweblogic.management.password=$BIEE_ADMIN_PASSWD" &
wait_for "Server started in RUNNING mode"
echo "********************************************************************************"
echo "Starting Node Manager on $(date)"
echo "********************************************************************************"
su $BI_USER -c "$WL_PATH/startNodeManager.sh" &
wait_for "socket listener started on port"
echo "********************************************************************************"
echo "Starting Managed Server $BIEE_SERVER on $(date)"
echo "********************************************************************************"
su $BI_USER -c "$BIEE_PATH/startManagedWebLogic.sh $BIEE_SERVER http://$BIEE_MANAGER_URL -Dweblogic.management.username=$BI_ADMIN -Dweblogic.management.password=$BIEE_ADMIN_PASSWD" &
wait_for "Server started in RUNNING mode"
echo "********************************************************************************"
echo "Starting BI components on $(date)"
echo "********************************************************************************"
su $BI_USER -c "$ORACLE_INSTANCE/bin/opmnctl startall"
echo "********************************************************************************"
echo "OBIEE start sequence completed on $(date)"
echo "********************************************************************************"
}
stop() {
echo "********************************************************************************"
echo "Stopping BI components on $(date)"
echo "********************************************************************************"
su $BI_USER -c "$ORACLE_INSTANCE/bin/opmnctl stopall"
echo "********************************************************************************"
echo "Stopping Managed Server $BIEE_SERVER on $(date)"
echo "********************************************************************************"
su $BI_USER -c "$BIEE_PATH/stopManagedWebLogic.sh $BIEE_SERVER t3://$BIEE_MANAGER_URL $BI_ADMIN $BIEE_ADMIN_PASSWD "
echo "********************************************************************************"
echo "Stopping Node Manager on $(date)"
echo "********************************************************************************"
pkill -TERM -u $BI_USER -f "weblogic\\.NodeManager"
echo "********************************************************************************"
echo "Stopping Admin Server on $(date)"
echo "********************************************************************************"
su $BI_USER -c "$BIEE_PATH/stopWebLogic.sh $BI_ADMIN $BIEE_ADMIN_PASSWD t3://$BIEE_MANAGER_URL"
echo "********************************************************************************"
echo "OBIEE stop sequence completed on $(date)"
echo "********************************************************************************"
}
wait_for() {
res=0
while [[ ! $res -gt 0 ]]
do
res=$(tail -5 "$START_LOG" | fgrep -c "$1")
sleep 5
done
}
case "$1" in
start)
echo "********************************************************************************"
echo "Starting Oracle Business Intelligence on $(date)"
echo "Logs are sent to $START_LOG"
echo "********************************************************************************"
start &> $START_LOG &
touch /var/lock/subsys/$SUBSYS
;;
stop)
echo "********************************************************************************"
echo "Stopping Oracle Business Intelligence on $(date)"
echo "Logs are sent to $STOP_LOG"
echo "********************************************************************************"
stop &> $STOP_LOG
rm -f /var/lock/subsys/$SUBSYS
;;
status)
echo "********************************************************************************"
echo "Oracle BIEE components status...."
echo "********************************************************************************"
su $BI_USER -c "$ORACLE_INSTANCE/bin/opmnctl status"
;;
restart)
$0 stop
$0 start
;;
*)
echo "Usage: $(basename $0) start|stop|restart|status"
exit 1
esac
exit 0