Discussion Locked

VBS swap ftp servers on connection timeout

0 helpful
2 replies
Closed to new repliesThis discussion is closed. It stays readable, but it takes no new replies.

Hi

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.

2 replies

by lowlands

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.

by matt h

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.

This discussion is closed to new replies.