Hi All,
I have created an ftp script to pull a file to one of our Unix Servers from our Unix Hosts. When I run the script I receive several errors and not sure why it is not running correctly. Can someone look at the script and tell me what could be wrong. Thanks so much.
#!/usr/local/bin/perl -w
use Net::FTP;
$store = shift;
$user = "root";
@password=&get_pass;
$date = `date +%m%d`;
chomp $date;
$dir = "/home/b088/ISP/daniel";
$file = "get_file2";
$local = "$dir/$file";
$remote = "/tmp/$file";
$| = 1;
$ftp = Net::FTP->new($store, Debug => 3);
$ftp->login($user, @password);
$ftp->binary();
$ftp->put($local, $remote);
$ftp->quit();
sub get_pass {
open (FH, "/home/b088/ISP/pass.txt" || die "can't open file $!";
@pass=<FH>;
close FH;
return @pass;
}
This is the output of the Debug ------
Net::FTP: Net::FTP(2.33)
Net::FTP: Exporter
Net::FTP: Net::Cmd(2.11)
Net::FTP: IO::Socket::INET
Net::FTP: IO::Socket(1.1603)
Net::FTP: IO::Handle(1.1504)
Net::FTP=GLOB(0x2017bdc8)<<< 220 bst00223 FTP server (Version 4.1 Tue Feb 16 14:
50:43 CST 1999) ready.
Net::FTP=GLOB(0x2017bdc8)>>> user root
Net::FTP=GLOB(0x2017bdc8)<<< 331 Password required for root.
Net::FTP=GLOB(0x2017bdc8)>>> PASS ....
Net::FTP=GLOB(0x2017bdc8)<<< 230 User root logged in.
Net::FTP=GLOB(0x2017bdc8)>>> TYPE I
Net::FTP=GLOB(0x2017bdc8)<<< 500 '': command not understood.
Net::FTP=GLOB(0x2017bdc8)>>> PORT 10,128,128,100,190,86
Net::FTP=GLOB(0x2017bdc8)<<< 200 Type set to I.
Net::FTP=GLOB(0x2017bdc8)>>> STOR /tmp/get_file2
Net::FTP=GLOB(0x2017bdc8)<<< 200 PORT command successful.
Net::FTP=GLOB(0x2017bdc8)>>> QUIT
Net::FTP=GLOB(0x2017bdc8)<<< 425 No data connection
Thanks Again!!!
I have created an ftp script to pull a file to one of our Unix Servers from our Unix Hosts. When I run the script I receive several errors and not sure why it is not running correctly. Can someone look at the script and tell me what could be wrong. Thanks so much.
#!/usr/local/bin/perl -w
use Net::FTP;
$store = shift;
$user = "root";
@password=&get_pass;
$date = `date +%m%d`;
chomp $date;
$dir = "/home/b088/ISP/daniel";
$file = "get_file2";
$local = "$dir/$file";
$remote = "/tmp/$file";
$| = 1;
$ftp = Net::FTP->new($store, Debug => 3);
$ftp->login($user, @password);
$ftp->binary();
$ftp->put($local, $remote);
$ftp->quit();
sub get_pass {
open (FH, "/home/b088/ISP/pass.txt" || die "can't open file $!";
@pass=<FH>;
close FH;
return @pass;
}
This is the output of the Debug ------
Net::FTP: Net::FTP(2.33)
Net::FTP: Exporter
Net::FTP: Net::Cmd(2.11)
Net::FTP: IO::Socket::INET
Net::FTP: IO::Socket(1.1603)
Net::FTP: IO::Handle(1.1504)
Net::FTP=GLOB(0x2017bdc8)<<< 220 bst00223 FTP server (Version 4.1 Tue Feb 16 14:
50:43 CST 1999) ready.
Net::FTP=GLOB(0x2017bdc8)>>> user root
Net::FTP=GLOB(0x2017bdc8)<<< 331 Password required for root.
Net::FTP=GLOB(0x2017bdc8)>>> PASS ....
Net::FTP=GLOB(0x2017bdc8)<<< 230 User root logged in.
Net::FTP=GLOB(0x2017bdc8)>>> TYPE I
Net::FTP=GLOB(0x2017bdc8)<<< 500 '': command not understood.
Net::FTP=GLOB(0x2017bdc8)>>> PORT 10,128,128,100,190,86
Net::FTP=GLOB(0x2017bdc8)<<< 200 Type set to I.
Net::FTP=GLOB(0x2017bdc8)>>> STOR /tmp/get_file2
Net::FTP=GLOB(0x2017bdc8)<<< 200 PORT command successful.
Net::FTP=GLOB(0x2017bdc8)>>> QUIT
Net::FTP=GLOB(0x2017bdc8)<<< 425 No data connection
Thanks Again!!!