论坛首页 Java企业应用论坛

ANT通过sshexec启动weblogic一直不能退出的解决方案

浏览 4119 次
精华帖 (0) :: 良好帖 (0) :: 新手帖 (0) :: 隐藏帖 (0)
作者 正文
   发表时间:2009-11-24  

通常我们通过sshexec来启动weblogic(其他服务器也适应)会采取如下方法:

<target name="startup">		
		<echo message="---${today}----- Starting Weblogic AdminServer -----"/>
		<parallel>				
			<sshexec host="15.154.146.101" username="bea" password="bea123" 
				trust="true" 
				command="/home/bea/smartdm/odomain/startWebLogic.sh"> 
			</sshexec>
			<sequential>
				<waitfor maxwait="10" maxwaitunit="minute" checkevery="1" checkeveryunit="second">
             		<http url="http://15.154.146.101:8001/testportal/admin"/>
         		</waitfor>				
				<antcall target="test-odomain"/>
     		</sequential>
		</parallel>
		<echo message="15.154.146.101 started successfully"/>    		
	</target>

 

命令行执行ant startup,都会停留在

<sshexec host="15.154.146.101" username="bea" password="bea123" 
				trust="true" 
				command="/home/bea/smartdm/odomain/startWebLogic.sh"> 
			</sshexec>

这一步上,即使加上nohup 。。。&,结果也都一样,通过大量的搜索以及实验,终于搞定,如下:

<sshexec host="15.154.146.101" username="bea" password="bea123" 
				trust="true" 
				commandResource="aa.ci"> 
			</sshexec>
 

aa.ci

#!/bin/sh

nohup /home/bea/smartdm/odomain/startWebLogic.sh >/dev/null 2>&1 &

  关键在于2>&1,将标准错误打到标准输出中。原因不明。

 

论坛首页 Java企业应用版

跳转论坛:
Global site tag (gtag.js) - Google Analytics