1、WebLogic的自启动。
A)在/etc/rc.d/init.d下创建weblogic文件,文件内容如下:
#!/bin/bash
#
# Startup script for the Apache Web Server
#
# chkconfig: - 85 15
# description: Apache is a World Wide Web server. It is used to serve \
# HTML files and CGI.
# processname: httpd
# pidfile: /var/run/httpd.pid
# config: /etc/httpd/conf/httpd.conf
# Source function library.
. /etc/rc.d/init.d/functions
# This will prevent initlog from swallowing up a pass-phrase prompt if
# mod_ssl needs a pass-phrase from the user.
INITLOG_ARGS=""
# Path to the apachectl script, server binary, and short-form for messages.
weblogic=/usr/bin/startWebLogic
prog=weblogic
RETVAL=0
# The semantics of these two functions differ from the way apachectl does
# things -- attempting to start while running is a failure, and shutdown
# when not running is also a failure. So we just do it the way init scripts
# are expected to behave here.
start() {
echo -n $"Starting $prog: "
#daemon "startWebLogic"
su - root -c "cd /root/bea812/user_projects/domains/bjstats/ && ./startWebLogic.sh &"
RETVAL=$?
echo
[ $RETVAL = 0 ] && touch /var/lock/subsys/weblogic
return $RETVAL
}
stop() {
echo -n $"Stopping $prog: "
#stopWebLogic
pid=`ps -ef | grep /root/bea812 | grep -v "grep" | awk '{print $2}'`
if [ "$pid" != "" ]
then
kill -9 $pid
else
echo "weblogic is not running."
fi;
RETVAL=$?
echo
[ $RETVAL = 0 ] && rm -f /var/lock/subsys/weblogic
}
# See how we were called.
case "$1" in
start)
start
;;
stop)
stop
;;
status)
#status "/root/bea812"
#RETVAL=$?
pid=`ps -ef | grep /root/bea812 | grep -v "grep" | awk '{print $2}'`
if [ "$pid" != "" ]
then
echo "weblogic is running."
else
echo "weblogic is not running."
fi;
;;
restart)
stop
start
;;
*)
echo $"Usage: $prog {start|stop|restart|status}"
exit 1
esac
exit $RETVAL
B)然后进行如下处理:
chown root:root weblogic
chmod -R 777 /home/bea/
cd /etc/rc.d/init.d/
以root身份运行chkconfig --add weblogic
在linux 菜单上找到服务器设置-->服务 打开,将weblogic设为开机自动启动保存
C)weblogic 启动会比较慢,请慢慢等,也可手动启动
启动 /etc/rc.d/init.d/weblogic start
停止 /etc/rc.d/init.d/weblogic stop
重启 /etc/rc.d/init.d/weblogic restart
2、由于我们经常远程启动weblogic,当我们关闭telnet窗口后就很难取回后台。解决办法:
创建一文件run.sh。内容如下:
nohup startWebLogic.sh &
然后就可以用tail命令取回后台输出了。
tail -f nohup.out
注意out文件的路径即可。如果愿意还可以跟自启动结合使用。