step1.
准备好weblogic的启动和关闭的脚本(startWeblogic.sh和stopWeblogic.sh)
可以参考:https://github.com/yangbijia/myShell/blob/master/README.md
step 2.
vim /etc/init.d/weblogic
#!/bin/bash# chkconfig: 2345 80 10# description: Weblogic Server auto start/stop script.# /etc/rc.d/init.d/weblogic# Please edit the variableexport BASE_PATH=/share/shexport LOG_PATH=/home/weblogic# if the executables do not exist -- display errorif [ ! -f $BASE_PATH/startWeblogic.sh -o ! -d $BASE_PATH ]then echo "WebLogic startup: cannot start" exit 1fi# depending on parameter -- startup, shutdown, restartcase "$1" in start) echo -n "Starting WebLogic,log file $LOG_PATH: " touch /var/lock/weblogic $BASE_PATH/./startWeblogic.sh echo "OK" ;; stop) echo -n "Shutdown WebLogic,log file $LOG_PATH: " rm -f /var/lock/weblogic $BASE_PATH/./stopWeblogic.sh echo "OK" ;; reload|restart) $0 stop $0 start ;; *) echo "Usage: `basename $0` start|stop|restart|reload" exit 1esacexit 0
step3.
给刚刚写的weblogic脚本文件执行权限
chmod +x /etc/init.d/weblogic
添加为服务
chkconfig –add weblogic
查看是否添加成功
chkconfig –list | grep weblogic
step4.
测试服务是否能成功运行
重启看看,是不是成功了
运行service weblogic stop或者service weblogic start或者service weblogic restart是否成功
联系客服