ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jan.Mate...@rzf.fin-nrw.de
Subject RE: Stopping and starting a service in Win2000 with Ant.
Date Thu, 24 Jul 2003 10:34:28 GMT
Insert a /C before 'net'.
I tried that with the windows message service (in Germany called
"Nachrichtendienst"):

<?xml version="1.0" encoding="ISO-8859-1"?>
<project name="test" basedir="." default="restart">
    <property name="service" value="Nachrichtendienst"/>
    <property name="user"    value="mat"/>
  
    <target name="stop" description="Stops the ${service}">
        <exec executable="cmd.exe">
            <arg line="/C net stop ${service}"/>
        </exec>
    </target>

    <target name="start" description="Starts the ${service}">
        <exec executable="cmd.exe">
            <arg line="/C net start ${service}"/>
        </exec>
    </target>


    <target name="send" description="Send a test message to ${user}">
        <exec executable="cmd.exe">
            <arg line="/C net send ${user} test"/>
        </exec>
    </target>


    <target name="restart" depends="stop,start"/>

</project>


And all that targets work.


Jan

> -----Original Message-----
> From: Gian Franco Casula [mailto:Gian.Franco.Casula@topficie.nl]
> Sent: Thursday, July 24, 2003 12:09 PM
> To: Ant Users List
> Subject: Re: Stopping and starting a service in Win2000 with Ant.
> 
> 
> Hi,
> 
> Thanks Jan.
> 
> I've just tried the suggested syntax (see below), but the 
> behaviour stays
> the same,
> the execution of Ant stalls.
> 
> ...
> <property name="service"  value="Netscape Enterprise Server 
> 3.6 (between)"/>
> ...
> <target name="restart" depends="clean"
>  description="Restarts Netscape Enterprise Server" >
>  <exec executable="cmd.exe">
>   <arg line="net stop ${service}"/>
>  </exec>
> </target>
> 
> Any suggestions are welcome?
> 
> Gian Franco
> 
> 
> ----- Original Message -----
> From: <Jan.Materne@rzf.fin-nrw.de>
> To: <user@ant.apache.org>
> Sent: Monday, July 21, 2003 7:03 AM
> Subject: RE: Stopping and starting a service in Win2000 with Ant.
> 
> 
> You donĀ“t need an external bat file.
> 
> <exec executable="cmd.exe"><arg line="net start 
> ${servicename}"/></exec>
> <exec executable="cmd.exe"><arg line="net stop  
> ${servicename}"/></exec>
> 
> Should do the same job.
> 
> 
> Jan
> 
> 
> 
> > -----Original Message-----
> > From: topfi101@vuurwerk.nl [mailto:topfi101@vuurwerk.nl]
> > Sent: Saturday, July 19, 2003 5:55 PM
> > To: user@ant.apache.org
> > Subject: Stopping and starting a service in Win2000 with Ant.
> >
> >
> > Hello,
> >
> > I'm trying to execute a batch file after the compilation of
> > my source with Ant. I added the required tags in the build.xml.
> > The batch file is simple, it should stop and start my Netscape
> > enterprise service under window 2000 with the following
> > command:
> >
> > net stop <servicename>
> > net start <servicename>
> >
> > In the Ant window I see that the DOS cmd command is
> > executed, but after that processing stops and Ant does
> > not give me the usual message 'COMPILATION SUCCESSFUL'.
> > When running the batch file without Ant it works fine.
> >
> > Can anyone help?
> >
> > Thanks,
> >
> > Gian Franco.
> >
> >
> >
> > 
> ---------------------------------------------------------------------
> > To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
> > For additional commands, e-mail: user-help@ant.apache.org
> >
> 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
> For additional commands, e-mail: user-help@ant.apache.org
> 

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message