`
wangrusheng5200
  • 浏览: 295312 次
  • 性别: Icon_minigender_1
  • 来自: 北京
社区版块
存档分类
最新评论

weblogic 后台启动脚本

阅读更多

问题描述:正常情况下,使用telnet或SSH登陆linux后,使用./startWeblogic.sh在用户推出登陆后,weblogic也会停掉,这是因为wls进程依赖于telnet进程。

问题解决:

编写后台运行脚本

weblogic10

#weblogic10
case $1 in
start)
 /opt/ccibs/weblogic10/user_projects/domains/base_domain/bin/startWebLogic.sh >/tmp/weblogic10.log 2>&1 &
;;
stop)
 /opt/ccibs/weblogic10/user_projects/domains/base_domain/bin/stopWebLogic.sh >/tmp/weblogic10.log 2>&1 &
;;
restart)
 /opt/ccibs/weblogic10/user_projects/domains/base_domain/bin/stopWebLogic.sh >/tmp/weblogic10.log 2>&1 &
/opt/ccibs/weblogic10/user_projects/domains/base_domain/bin/startWebLogic.sh >/tmp/weblogic10.log 2>&1 &
 
;;
*)
echo "usage:weblogic10 start|stop|restart"
;;
esac
exit 0

 拷贝代码到:/etc/init.d/

 执行代码:/etc/init.d/weblotic10 start|stop|restart

 ps:这段代码是以普通用户身份登录的,本段代码稍加修改 就可以启动tomcat

以下代码只是启动关闭tomcat 并没有在后台运行,有需要可参考上面代码修改

#tomcat6
case $1 in
start)
 /home/ubuntu/apache-tomcat-6.0.20/bin/startup.sh
;;
stop)
 /home/ubuntu/apache-tomcat-6.0.20/bin/shutdown.sh
;;
restart)
 /home/ubuntu/apache-tomcat-6.0.20/bin/shutdown.sh
 /home/ubuntu/apache-tomcat-6.0.20/bin/startup.sh

;;
*)
echo "usage:tomcat6 start|stop|restart"
;;
esac

我们还可以以root身份自行脚本,当执行启动命令时切换用户。部分代码

su -c /opt/ccibs/weblogic10/user_projects/domains/base_domain/startWebLogic.sh - user1 >/tmp/weblogic10.log 2>&1 &

 参考文章:

Linux与unix shell编程指南_第一部分shell_第3章后台执行命令

http://hi.baidu.com/iameyama/blog/item/749eee2cce68bde98b13996f.html

Shell-Ch3.后台执行命令
http://blog.chinaunix.net/u/11665/showart_62256.html

Linux 下后台启动Weblogic

http://fengpeng.iteye.com/blog/93868

分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics