On 11/28/07, Agarkar, M (Milind) <[EMAIL PROTECTED]> wrote:
> Thanks Jan.
> Any idea about how to trap a PID on-the-fly ? It would be a script to run
> automatically.
>
In snapshot testing we use the next targets to find and kill hung VMs
after a suite run.
<target name="clear-processes"
if="need.processes.cleanup"
depends="-init-clear-processes">
<echo>PROCESSES: ${proccess}</echo>
<exec executable="kill">
<arg line="${proccess}" />
</exec>
</target>
<target name="-init-clear-processes" unless="is.windows">
<exec executable="ps">
<arg value="a" />
<redirector outputproperty="proccess">
<outputfilterchain>
<!-- select only snapshot vm -->
<linecontainsregexp>
<regexp pattern="\s${jvm.location}\s" />
</linecontainsregexp>
<!-- get processes pids -->
<tokenfilter>
<replaceregex pattern="^\s*(\d+).*" replace="\1 " />
</tokenfilter>
<striplinebreaks />
</outputfilterchain>
</redirector>
</exec>
<condition property="need.processes.cleanup">
<and>
<istrue value="${do.processes.cleanup}" />
<length string="${proccess}"
trim="true"
when="greater"
length="0" />
</and>
</condition>
</target>
Thanks,
Stepan.
> -----Original Message-----
> From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]
> Sent: 28 November 2007 13:24
> To: [email protected]
> Subject: AW: Stopping a process identified by name
>
> No, there is no build-in task for that.
> You could use <exec> in combination of a system command "kill" and the
> process id ...
>
> Jan
>
> > -----Ursprüngliche Nachricht-----
> > Von: Agarkar, M (Milind) [mailto:[EMAIL PROTECTED]
> > Gesendet: Mittwoch, 28. November 2007 14:05
> > An: Ant Users List
> > Betreff: Stopping a process identified by name
> >
> > Hi,
> >
> > Is there a way to stop/kill a process running on unix using the ant
> > script ? Would I need to write a custom task ?
> >
> > Thanks,
> > Milind
> > _____________________________________________________________
> >
> > This email (including any attachments to it) is confidential, legally
> > privileged, subject to copyright and is sent for the personal
> > attention of the intended recipient only. If you have received this
> > email in error, please advise us immediately and delete it. You are
> > notified that disclosing, copying, distributing or taking any action
> > in reliance on the contents of this information is strictly
> > prohibited. Although we have taken reasonable precautions to ensure no
> > viruses are present in this email, we cannot accept responsibility for
> > any loss or damage arising from the viruses in this email or
> > attachments. We exclude any liability for the content of this email,
> > or for the consequences of any actions taken on the basis of the
> > information provided in this email or its attachments, unless that
> > information is subsequently confirmed in writing. If this email
> > contains an offer, that should be considered as an invitation to
> > treat.
> > _____________________________________________________________
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: [EMAIL PROTECTED] For additional
> > commands, e-mail: [EMAIL PROTECTED]
> >
> >
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail:
> [EMAIL PROTECTED]
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]