应用场景
weblogic在linux端安装完毕后,启动,关闭weblogic比较麻烦,可以通过配置,将weblogic注册成服务,只要简单的服务start,stop即可开关服务,十分方便。
操作步骤
1. 在root用户,opt目录创建脚本文件weblogic
# cd /opt
# vim weblogic #将下列内容拷贝到文件中
AI 代码解读
#!/bin/bash
#
# chkconfig: 345 81 05
# description: Weblogic Server
# /etc/init.d/weblogic
#
# Run-level Startup script for the WebLogic Server
# Please edit the Variable
export BEA_BASE= /bea
export BEA_HOME=$BEA_BASE/user_projects/domains/aaaaa
export BEA_LOG=$BEA_BASE/weblogic.log
export PATH=$PATH:$BEA_HOME/bin
BEA_OWNR="root"
# if the executables do not exist -- display error
if [ ! -f $BEA_HOME/bin/startWebLogic.sh -o ! -d $BEA_HOME ]
then
echo "WebLogic startup: cannot start"
exit
fi
# depending on parameter -- startup, shutdown, restart
case "$1" in
start)
echo -n "Starting WebLogic: log file $BEA_LOG"
touch /var/lock/weblogic
su $BEA_OWNR -c "nohup $BEA_HOME/bin/startWebLogic.sh > $BEA_LOG 2>&1 &"
echo " OK"
;;
stop)
echo -n "Shutdown WebLogic: "
rm -f /var/lock/weblogic
su $BEA_OWNR -c "$BEA_HOME/bin/stopWebLogic.sh >> $BEA_LOG"
echo "OK"
;;
reload|restart)
$0 stop
$0 start
;;
*)
echo "Usage: `basename $0` start|stop|restart|reload"
exit 1
esac
exit 0
AI 代码解读
2. 添加到自启动/etc/rc.d。
# chmod 700 weblogic
# cp weblogic /etc/rc.d/init.d
# chkconfig --add weblogic
# chkconfig --list | grep weblogic
AI 代码解读
3. 调用方法:
1:service weblogic start|stop|restart|reload
2:/etc/init.d/weblogic start|stop|restart|reload
AI 代码解读
4. 项目部署
登陆weblogc控制台,一般是http://ip地址:7001/console,进入部署菜单,选择需要部署的应用程序目录,直接下一步即可部署成功。