|
通常我们通过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,将标准错误打到标准输出中。原因不明。 |
|
|
|
|
|
|