SQL job - Who's up for the challenge ?

  • Hello everyone, I'm new here and I'm gonna jump straight into the deep end!..

    I have a SQL job that runs a cmdexec every hour.. which FTPs files from a specified directory and archives them regardless of the files being sent successfully or not.

    My problem is the not part!...

    Is it possible to have the job setup so that it FTP's the files and if this fails will try again before archiving them?

    at the moment the job is set up as below:

    e:\ftpscript\FTPScript_v1.7.exe /src E:\"folder"\ /archive e:\"folder"\archive /log e:\"folder"\log

    and alot of the time I get an error saying:

    "Upload startedUnrecoverable error: Transfer failed: "/exchange" <-

    "e:\"folder"\archive\2007-10-17_10-01-17"

    so I would have to go in and manually move the files back to the FTP folder and kick off the job manually, which normally works the second time..

    I guess I'm after a retry of some kind ?

    Thanks everyone for any help you can give.

    Gazza.

  • The issue is if the error is returned by the program. You could write a batch file, include your command and then check the ERRORLEVEL environmental variable. Most programs used to set that to 1 if an error occurred (or some non-zero value). If it's 0, should be ok. If not, set a label above the command and loop back to the label.

    Anything more sophisticated would probably require scripting and you'd need a way to hook into the FTP program and drive it and receive data back.

  • Agree with Steve. Having written one of these kinds of programs, most FTP clients (even automated ones) I ran into were very patchy at reporting an error when the connection failed, especially once a connection has been started (i.e. a timeout or a drop of connection).

    We ended up buying an FTP client SDK that we could drive from .NET (which would allow us to know whether a connection just "died" versus successful transfer).

    ----------------------------------------------------------------------------------
    Your lack of planning does not constitute an emergency on my part...unless you're my manager...or a director and above...or a really loud-spoken end-user..All right - what was my emergency again?

Viewing 3 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic. Login to reply