转至:http://blog.chinaunix.net/uid-20164485-id-1973841.html
自动启动WebLogic系统的服务脚本 2010.10.25 TsengYia#126.com http://tsengyia.blog.chinaunix.net/ ***********************************************系统环境:RHEL5.0 [2.6.18-128xen]
***************************************************************** —— Weblogic运行在product模式,手动运行或终止时需验证用户名和密码。 一、创建/etc/init.d/weblogic脚本文件
#!/bin/bash # # By TsengYia#126.com http://selinux.cublog.cn # # chkconfig: - 85 15 # description: Startup/Stop script for the WebLogic Server # # Source function library. . /etc/rc.d/init.d/functions # # JDK Configuration JAVA_HOME=/usr/local/jdk CLASSPATH=.:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar PATH=$PATH:$JAVA_HOME/bin # SRV_IPADD="172.20.20.1" WLS_USER="user_to_run_wls" WLS_PW="123456" WLS_INIT_PATH="/usr/local/weblogic/user_projects/domains/mydomain/bin" export JAVA_HOME CLASSPATH PATH MW_HOME WLS_USER WLS_PW # case "$1" in start) ${WLS_INIT_PATH}/startWebLogic.sh & ;; stop) ${WLS_INIT_PATH}/stopWebLogic.sh $WLS_USER $WLS_PW ;; status) if ( pgrep "java" && ps ax | grep "${SRV_IPADD}:80" ) &> /dev/null ; then echo "WebLogic Server is running." exit 0 else echo "WebLogic Server is down." exit 1 fi ;; restart) $0 stop $0 start ;; *) echo "Usage:$0 start|stop|status|restart" ;; esac二、添加为weblogic系统服务
[root@localhost ~]# chmod 750 /etc/init.d/weblogic [root@localhost ~]# chkconfig --add weblogic [root@localhost ~]# chkconfig --level 35 weblogic on [root@localhost ~]# /etc/init.d/weblogic start