I am trying to send certain files to 3 different ftp servers. I have it working but the issue is, is when one fo the requests fail, they all fail. I would like to set it up so that if one of the servers fails, it still sends the files to the other two ftp servers.
This is the part of the code that I have for defining my ftp servers. Is there a way to rewrite this so it will send the files to all ftp servers even if one fails?
*****************
my $ftpa = Net::FTP->new("[removed]", Debug => 0) or die "Cannot connect to ftp server A: $@";
my $ftpb = Net::FTP->new("[removed]", Debug => 0) or die "Cannot connect to ftp server B: $@";
my $ftpc = Net::FTP->new("[removed]", Debug => 0) or die "Cannot connect to ftp server C: $@";
$ftpa->login('[removed]','[removed]') or die "Cannot login to FTP server A.", $ftpa->message;
$ftpb->login('[removed]','[removed]') or die "Cannot login to FTP server B.", $ftpb->message;
$ftpc->login('[removed]','[removed]') or die "Cannot login to FTP server C.", $ftpc->message;
$ftpa->ascii; $ftpb->ascii; $ftpc->ascii;
chdir("$RPTDIR/tobesent");
opendir(FTPDIR,"$RPTDIR/tobesent");
my $FILE;
foreach $FILE (readdir(FTPDIR)) {
...
***********************
Thanks for any help!
This is the part of the code that I have for defining my ftp servers. Is there a way to rewrite this so it will send the files to all ftp servers even if one fails?
*****************
my $ftpa = Net::FTP->new("[removed]", Debug => 0) or die "Cannot connect to ftp server A: $@";
my $ftpb = Net::FTP->new("[removed]", Debug => 0) or die "Cannot connect to ftp server B: $@";
my $ftpc = Net::FTP->new("[removed]", Debug => 0) or die "Cannot connect to ftp server C: $@";
$ftpa->login('[removed]','[removed]') or die "Cannot login to FTP server A.", $ftpa->message;
$ftpb->login('[removed]','[removed]') or die "Cannot login to FTP server B.", $ftpb->message;
$ftpc->login('[removed]','[removed]') or die "Cannot login to FTP server C.", $ftpc->message;
$ftpa->ascii; $ftpb->ascii; $ftpc->ascii;
chdir("$RPTDIR/tobesent");
opendir(FTPDIR,"$RPTDIR/tobesent");
my $FILE;
foreach $FILE (readdir(FTPDIR)) {
...
***********************
Thanks for any help!