I’m not sure what can be wrong here since out of 10 servers, 2 are giving me the error:
Cannot connect to sun09 : Net::FTP: Bad hostname ‘sun09:’ at deploy_update.pl line 204.
The weird thing is, the following code extract works inside a loop, and works for some servers, but for the sun09 server I’m unable to connect.
$ftp = Net::FTP->new("$hostname:$ftp_port", Debug => 0)
or die "Cannot connect to $hostname : $@";
$ftp->login($iLogin,$iPass)
or die "failed ", $ftp->message;
$ftp->binary()
or die "Cannot set to Binary";
$ftp->delete("/admin/replicate/inbound/$file");
#or warn $ftp->message;
$ftp->cwd("/admin/replicate/inbound")
or die "Cannot change working directory ", $ftp->message;
$ftp->put("$file")
or die "Upload Failed ", $ftp->message;
$ftp->quit;
This works for 8 of 10 servers but not for sun08 and sun09.
Looks like
$ftp_portis empty for those hosts; you should omit the colon entirely if you want to use the default port.