What is the best solution to remotely start and stop the apache service (running as a windows service) from an ANT script. I looked into the exec tag to run it by executing cmd.exe.
We had apache running on Windows 2000 server where we called the sc.exe directly from the ant script to stop and start the apache service. However, we recently migrated to Windows 2003 which has more security at teh OS level so a non administrator user cannot start the sc.exe remotely. What are the other options that can be used to start and stop the apache server from the build script.
Can someone please provide sample ant code to do this ASAP?
Please note that apache is running on a remote server.
The adminsitrators are ok with any solution to start and stop the service remotely as long as they dont have to give the user running the ant script to do this does not need admninstrator rights on the server or giving adminstrator rights to the user but the password is not visible in the ant script or anywhere in the properties.
The administrators are ok with executing any .exe or script , etc on the server locally once we connect to the server (Windows 2003 server).
Prabha, One solution is to create a script on the remote machine that calls the start/stop service command. This script can be set to run by any user (or whatever user you run ant as) but "run as" a user that can stop/start the service.
I know this works on UNIX. I haven't used Windows Server, but assume they have something similar.