• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Tim Cooke
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Liutauras Vilda
Sheriffs:
  • Rob Spoor
  • Junilu Lacar
  • paul wheaton
Saloon Keepers:
  • Stephan van Hulst
  • Tim Moores
  • Tim Holloway
  • Carey Brown
  • Scott Selikoff
Bartenders:
  • Piet Souris
  • Jj Roberts
  • fred rosenberger

Start and stop apache service running on a remote server in ANT

 
Ranch Hand
Posts: 70
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.

Many thanks in advance!
 
author & internet detective
Posts: 41110
848
Eclipse IDE VI Editor Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Prabha,
Before trying to figure out what to do in Ant, you need to figure out how to start/stop the service remotely. What do the administrators who tightened security recommend?
 
Prabha Dhandapani
Ranch Hand
Posts: 70
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks for the response Jeanne!

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).

Thanks,
Prabha
 
Jeanne Boyarsky
author & internet detective
Posts: 41110
848
Eclipse IDE VI Editor Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
 
Ranch Hand
Posts: 198
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Is there any way i can access and restart apache in another development machine ???.. because i have to restart the apache of my friends machine ??? ...

we both are using windows machine, i have to access while his computer has locked....
 
author
Posts: 3281
8
Mac OS X Eclipse IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi there, you might be better off posting this question in the Tomcat Forum.
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic