在debian上执行init.d脚本时,ant任务挂起
问题描述:
我有一个init.d脚本,用于在debian squeeze上启动java进程。如果我在蚂蚁蚂蚁构建调用这个脚本,如:在debian上执行init.d脚本时,ant任务挂起
<target name="deploy-CdrServer-local">
<ant antfile="${CdrServer.location}/build.xml" target="deploy-local" inheritAll="false">
<property name="basedir" value="${CdrServer.location}" />
</ant>
<exec dir="/etc/init.d" spawn="false" executable="bash" newenvironment="false">
<arg line="cdrserver restart"/>
</exec>
</target>
脚本以下输出后执行,但比蚂蚁“挂起”:
[copy] Copying 1 file to /opt/CdrServer
[copy] Copying 7 files to /opt/CdrServer/CdrServer_lib
[exec] Stopping CdrServer ...
[exec] CdrServer server process stopped
[exec] Starting CdrServer ...
[exec] cat $PIDFILE
[exec] CdrServer has PID: 24170
[exec]
[exec]
[exec] restarted CdrServer
[exec] exit 0
我在蚂蚁实况可见,设置inputstring =“”作为参数将有所帮助,但它不...
任何想法?
答
我发现当执行产生后台子进程的脚本时,ant挂在solaris上。
为了解决这个问题,我修改了这个脚本,以便它吐出一个文件“yes yes done”。然后我改变了ant文件以删除该文件,用spawn-“true”执行脚本,然后等待该文件出现。
init.d脚本通常以root身份运行。这可能是一个问题吗? – 2012-02-27 22:12:03
在我的演示环境中,我也以root身份运行ant,同样的问题。 – markus 2012-02-28 10:13:42