system("ftp -n $gsRemoteMachine < $gsStatusFile 2>&1\n\nuser $gsFtpId$gsGateConnect $gsFtpPwd\nverbose\n$gsFtpMode\nput $gsFeedsDir$gsFeedZipFile $gsRemoteDir$gsFeedZipFile\nclose\nbye\nEOF"); print "verifying FTP status..."; # Get FTP session record if(!open(STATUSFILE, $gsStatusFile)) { print "\n".$gsSysErr."Cannot open file $gsStatusFile. FTP failed.\n"; email_error($gsEmailAdmin, $gsErrSys, $gsErrSys."Cannot open file $gsStatusFile. FTP failed."); } @gaStatusLines = ; close(STATUSFILE); # check if "226 Transfer complete." occurs in gaStatusLines array for( $ii=0; $ii<=$#gaStatusLines; $ii++) { if(@gaStatusLines[$ii] eq "226 Transfer complete.\n") { $gnFtpFailed = 0; break; } } if( $gnFtpFailed ) { # "226 Transfer Complete" not found in gaStatusLines, so FTP failed. # print FTP fail message print "\n".$gsSysErr."FTP failed.\n"; print "\nFTP session:\n"; print @gaStatusLines; # send admin email email_error($gsEmailAdmin, $gsErrSys, $gsErrSys."FTP failed.\nFTP session:\n@gaStatusLines"); } #### use Net::FTP; my $ftp; if (!($ftp = Net::FTP->new($gsGateMachine, -Passive => '1', -Firewall => $gsGateMachine)) ) { email_error($gsEmailAdmin, $gsErrSys, $gsErrSys."Connect failed. $@"); } $ftp->login("$gsFtpId\@$gsRemoteMachine","$gsFtpPwd"); if ( $ftp->put("$gsFeedsDir$gsFeedFile")) { push @ReportArray, "\nAJB FILE FTP SUCCESSFUL!\n"; else { push @ReportArray, "\n\tAJB FILE FTP FAILED $@\n"; email_error($gsEmailAdmin, $gsErrSys, $gsErrSys."FTP failed. $@"); }