General discussion


VBS swap ftp servers on connection timeout

By Matt H ·

I have a vb script to upload files to an ftp server - works very well, but the next stage of development is to be able to automatically switch to a second mirror server if the connection times out (eg server dead, WAN down etc). The part of the script that does the ftp is:

Set wshell = CreateObject("WScript.Shell")
'wshell.Run("ftp -i -s:" & chr(34) & strFTPScriptFileName & chr(34))
Return = wshell.Run("ftp -i -s:" & chr(34) & strFTPScriptFileName & chr(34), , True)

don't quite know the best way to go about this though - there are several things I think I could do but I'm no programmer, I write scripts to do a job at the time.

This conversation is currently closed to new comments.

Thread display: Collapse - | Expand +

All Comments

Collapse -


by lowlands In reply to VBS swap ftp servers on c ...

You could insert a ping routine, if it succeeds you user ftpserver1, otherwise ftp server2. To make this happen though, you'd have to also generate you ftpscript file from within the vbscript.

Collapse -

Can't do it that way I'm afraid...

by Matt H In reply to idea

Thanks for the reply, I can't ping the destination server as the ftp server is in a DMZ. I could use ncftpput as it generates exit codes, so I could say if exitcode <> 0 use server 2 or something, but not sure how to go about it in VB. The ftp script is automatically generated, used, then deleted along with the source file.
I have to use VB as the server only runs vb scripts if I want to use event generated file transfer.

Related Discussions

Related Forums