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文件的路徑即可。如果愿意還可以跟自啟動結合使用。