I have Apache Ant file (build.xml) which is set to create automatic backup of my production server. It is set to stop Apache server & MSSQL2000 - backup everything and start both services (and their dependencies) again. It is working fine under the old WIN 2008 server but not under the WIN8. When the .bat file is executed to run the Ant processes it opens the CMD (as it should) but none of the stop/start operation execute properly. I am getting "Access is denied." response.
This is the CMD output when .bat (Ant) file is executed:
assemble:
stop.server.apache:
[exec] System error 5 has occurred.
[exec]
[exec] Access is denied.
[exec]
[exec] Result: 2
stop.server.ms-sql:
[exec] No valid response was provided.
[exec] The following services are dependent on the MSSQLSERVER service.
[exec] Stopping the MSSQLSERVER service will also stop these services.
[exec]
[exec] SQLSERVERAGENT
[exec]
[exec] Do you want to continue this operation? (Y/N) [N]:
[exec] Result: -1
[exec] System error 5 has occurred.
[exec]
[exec] Access is denied.
[exec]
[exec] Result: 2
the actual build.xml portion responsible for starting/stopping services is as follows:
....... beginning of the code
<macrodef name="service">
<attribute name="service"/>
<attribute name="action"/>
<sequential>
<exec executable="cmd.exe">
<arg line="/c net @{action} '@{service}'"/>
</exec>
</sequential>
</macrodef>
<target name="start.server.ms-sql">
<service action="start" service="MSSQLSERVER"/>
<service action="start" service="SQLSERVERAGENT"/>
</target>
<target name="stop.server.ms-sql">
<service action="stop" service="SQLSERVERAGENT"/>
<service action="stop" service="MSSQLSERVER"/>
</target>
<target name="start.server.apache">
<service action="start" service="Apache2.2"/>
</target>
<target name="stop.server.apache">
<service action="stop" service="Apache2.2"/>
</target>
....... more code here
I already enabled all disk/folder permissions to make sure it is not being affected (I know there has been permission changes from Vista and up. I also studied the Apache Ant documentation but I could not find anything about stopping/starting services with elevated privileges.
Any idea ?
NOTE: the Apache2.2 and MSSQL are running from the drive W:\ and the Win OS is running from C:. My Ant paths are set correctly but I thought this may be contributing to the privilege access issue.