2011-11-15 39 views
0

我搜索,发现了一些疑问句作为**如何使用恶性脚本来重新启动Apache **,并试图类似的代码,但有一些message..i尝试这种代码使用Ant脚本为unix和windows系统重新启动Apache?

<exec executable="${APACHE_HOME}/bin/httpd.exe"> 
    <arg value="-k"/> 
    <arg value="restart"/> 
</exec> 

OUTPUT:

apache-restart: 
    [exec] [Tue Nov 15 19:58:18 2011] [error] (OS 2)The system cannot find the file specified. : No installed ser 
vice named "Apache2.2". 
    [exec] Result: 2 

而原因是我猜Apache没有安装作为一个Windows服务。

我都尝试,但都有问题:

1)我的光标不停闪烁,没有达到下一个语句回声。

<target name="test" depends="init"> 
    <exec executable="${APACHE_HOME}/bin/httpd.exe"> 
    </exec> 
    <echo message="hello "/> 
</target> 

OUTPUT:

test: 

2)其中,是这个文件TASKKILL本??

<target name="test" depends="init"> 
       <exec executable="taskkill /im httpd.exe"> 
       </exec> 
       <echo message="hello "/> 
</target> 

OUTPUT:

Execute failed: java.io.IOException: Cannot run progra 
"taskkill \im httpd.exe": CreateProcess error=2, The system cannot find the file specified 
     at java.lang.ProcessBuilder.start(ProcessBuilder.java:460) 

回答

0

好了,先用httpd.exe -k install

安装服务或者你可以执行taskkill /im httpd.exe杀Apache和httpd.exe再次启动它。您可能还想将/f开关添加到taskkill

+0

谢谢..但它已经由基于Java的应用程序作为子安装程序Web服务器安装..所以我不应该更改该配置。 – user1037728

+0

@ user1037728,然后执行“taskkill/im httpd.exe”来杀死Apache和“httpd.exe”来重新启动它。您可能还想追加/ f切换到taskkill。 –

相关问题