Ok. Actually it just requires a small modification:

<target name="checkFTPfailure">
  <!-- Do whatever to determine FTP failure.
       (Using 'uptodate' task?)
       If FTP has succeeded, set a property.
  -->
  <property name="ftp.ok" value="true"/>
</target>

<target name="ftpLoop" depends="checkFTPfailure" unless="ftp.ok">
  <FTP .../>
  <antcall target="ftpLoop2"/>
</target>

<target name="ftpLoop2" depends="checkFTPfailure" unless="ftp.ok">
  <FTP .../>
  <antcall target="ftpLoop"/>
</target>

<target name="ftp" depends="ftpLoop"/>

Note that 'checkFTPfailure' will be called *before* you attempt your
first FTP. This should be fine, since you haven't even attempted an FTP
yet that *certainly* should be a failure!  :)

- Don


--- "O'Hara, Patrick" <[EMAIL PROTECTED]> wrote:
> Yes I was hoping for a loop until successful.
> 
> Patrick O'Hara
> 262-408-3849
> [EMAIL PROTECTED]
> 
> 
> 
> 
> -----Original Message-----
> From: Don Taylor [mailto:[EMAIL PROTECTED]]
> Sent: Wednesday, June 27, 2001 9:29 AM
> To: [EMAIL PROTECTED]
> Subject: Re: Retry task on Error
> 
> 
> 
> --- "O'Hara, Patrick" <[EMAIL PROTECTED]> wrote:
> > Is there a way to retry a task when it errors out?  I have a FTP
> > task.  The
> > server we are connecting to is a little hit and miss.  I would like
> > to retry
> > the FTP task if it fails to send all the files.
> > 
> 
> I'm assuming you can already figure out if the FTP task has failed.
> Put
> that logic in a target:
> 
> <target name="checkFTPfailure">
>   <!-- Do whatever to determine FTP failure.
>        (Using 'uptodate' task?)
>        If FTP has failed, set a property.
>   -->
>   <property name="ftp.failed" value="true"/>
> </target>
> 
> 
> Now you're ready to try your FTP:
> 
> <target name="ftpFirst">
>    <FTP .../>
> </target>
> 
> <target name="ftpSecond" depends="checkFTPfailure"
> unless="ftp.failed">
>    <FTP .../>
> </target>
> 
> <target name="ftp" depends="ftpFirst,ftpSecond"/>
> 
> You see your 'ftp' target will FTP your files, and failing that, will
> try again. If you desire to loop until the FTP is complete, let me
> know, that's a lot trickier (but possible.)
> 
> - Don
> 
> 
> __________________________________________________
> Do You Yahoo!?
> Get personalized email addresses from Yahoo! Mail
> http://personal.mail.yahoo.com/
> 


__________________________________________________
Do You Yahoo!?
Get personalized email addresses from Yahoo! Mail
http://personal.mail.yahoo.com/

Reply via email to