Post a reply

Options
Add an Attachment

If you do not want to add an Attachment to your Post, please leave the Fields blank.

(maximum 10 MB; please compress large files; only common media, archive, text and programming file formats are allowed)

Options

Topic review

martin

JaneDoe3 wrote:

@echo off

"C:\Program Files (x86)\WinSCP\WinSCP.com" ^
/log="C:\Temp\Log_%Date:~4,2%%date:~7,2%%date:~10,4%.log" /ini=nul ^
/command ^
"open sftp://username:password@10.99.36.292 -hostkey=""ssh-rsa 2048 """ ^
"open sftp://username:password@10.99.36.183 -hostkey=""ssh-rsa 2048 """ ^

Then it goes into the search for the SFTP folders for download of most recent data.

The error I get: Network Error: Connection to "10.99.36.292" refused.
This is the offline IP Address...the second one is the active one currently.

This can work too, but you need to set option batch continue before the first open command to avoid the script exiting if the open fails. After the first open, you should reset back to option batch abort.
JaneDoe3

@echo off

"C:\Program Files (x86)\WinSCP\WinSCP.com" ^
/log="C:\Temp\Log_%Date:~4,2%%date:~7,2%%date:~10,4%.log" /ini=nul ^
/command ^
"open sftp://username:password@10.99.36.292 -hostkey=""ssh-rsa 2048 """ ^
"open sftp://username:password@10.99.36.183 -hostkey=""ssh-rsa 2048 """ ^

Then it goes into the search for the SFTP folders for download of most recent data.

The error I get: Network Error: Connection to "10.99.36.292" refused.
This is the offline IP Address...the second one is the active one currently.
JaneDoe3

DR IP Address in Batch Script

Hello -

Looking to see if anyone has added a DR or second rollover/failover IP Address to their WinSCP Batch script?

The Primary Data Center rotates once or twice a year and looking to automate this, so when the script fails to connect to the first IP Address in the script, it rolls to the next IP Address and tries that.
Attempts to try this so far have failed to produce the results I was hoping for.