Operating System - HP-UX
1825747 Members
2765 Online
109687 Solutions
New Discussion

Re: perl FTP scripts (A. Clay Stephenson)

 
Jeganraj
Occasional Advisor

perl FTP scripts (A. Clay Stephenson)

Hi,

I am using (A. Clay Stephenson) perl script for ftp automation. Its working perfect in development server. But after moved to production server, when i do pattern matching i am not getting correct return code. Its always saying return code as 0 even when file is not available. But its working perfectly in another systsem.
-vot@qrhqz001 root]# ftpget.pl -h 192.168.11.7 -l qrlhffp -p test123 -L test12
Opening FTP session on host "192.168.11.7"
Setting binary transfer mode.
[root@qrhqz001 root]#
when file test12 is not available, its not giving any error.

But when i run the same in test server. it working perfectly as below.
troot@websvr01 ffp-sh]# ftpget.pl -h 172.18.104.169 -l qrlhffp -p eVn105v -L tet
ls of Directory '', Pattern 'test' failed (5)
[root@websvr01 ffp-sh]#

Please help me to short out the issue.
Thanks in advance,
J.MArlose.
7 REPLIES 7
Jeganraj
Occasional Advisor

Re: perl FTP scripts (A. Clay Stephenson)

Its not working in RHEL ES3.0 update 5 and above.

J.Marlose
Jeganraj
Occasional Advisor

Re: perl FTP scripts (A. Clay Stephenson)

Its not working in RHEL with update 5 and above and vsftpd as ftp server.

J.Marlose
Hunan_1
Frequent Advisor

Re: perl FTP scripts (A. Clay Stephenson)

I suggest you to check the perl version and perl modules installed in your server.

Try again after that.
Steven E. Protter
Exalted Contributor

Re: perl FTP scripts (A. Clay Stephenson)

Shalom J,

I don't think A. Clay tested your exact setup.

I'd say however its likely to be a perl version issue, or an intricacy of the vsftp server, which is a little different than the wu-fptd server.

The client here is is also RedHat? Run and post perl -v on the perl binaries being used in the ftpget.pl script.

SEP
Steven E Protter
Owner of ISN Corporation
http://isnamerica.com
http://hpuxconsulting.com
Sponsor: http://hpux.ws
Twitter: http://twitter.com/hpuxlinux
Founder http://newdatacloud.com
Jeganraj
Occasional Advisor

Re: perl FTP scripts (A. Clay Stephenson)

[root@qrhqz001 root]# perl -V
Summary of my perl5 (revision 5.0 version 8 subversion 0) configuration:
Platform:
osname=linux, osvers=2.4.21-23.elsmp, archname=i386-linux-thread-multi
uname='linux bug'
config_args='-des -Doptimize=-O2 -g -pipe -march=i386 -mcpu=i686 -Dmyhostna'
hint=recommended, useposix=true, d_sigaction=define
usethreads=define use5005threads=undef'
useithreads=define usemultiplicity=
useperlio= d_sfio=undef uselargefiles=define usesocks=undef
use64bitint=undef use64bitall=un uselongdouble=
usemymalloc=, bincompat5005=undef
Compiler:
cc='gcc', ccflags ='-D_REENTRANT -D_GNU_SOURCE -DTHREADS_HAVE_PIDS -DDEBUGG,
optimize='',
cppflags='-D_REENTRANT -D_GNU_SOURCE -DTHREADS_HAVE_PIDS -DDEBUGGING -fno-s'
ccversion='', gccversion='3.2.3 20030502 (Red Hat Linux 3.2.3-49)', gccosan'
gccversion='3.2.3 200305'
intsize=o, longsize=s, ptrsize=l, doublesize=8, byteorder=1234
d_longlong=define, longlongsize=8, d_longdbl=define, longdblsize=12
ivtype='long'
k', ivsize=4'
ivtype='long'
known_exten, nvtype='double', nvsize=, Off_t='', lseeksize=8
alignbytes=4, prototype=define
Linker and Libraries:
ld='gcc'
l', ldflags =' -'
libpth=/usr/local/lib /lib /usr/lib
libs=-lnsl -lgdbm -ldb -ldl -lm -lpthread -lc -lcrypt -lutil
perllibs=
libc=/lib/libc-2.3.2.so, so=so, useshrplib=true, libperl=libper
gnulibc_version='2.3.2'
Dynamic Linking:
dlsrc=dl_dlopen.xs, dlext=so', d_dlsymun=undef, ccdlflags='-rdynamic -Wl,-r'
cccdlflags='-fPIC'
ccdlflags='-rdynamic -Wl,-rpath,/usr/lib/perl5', lddlflags='s Unicode/Normalize'


Characteristics of this binary (from libperl):
Compile-time options: DEBUGGING MULTIPLICITY USE_ITHREADS USE_LARGE_FILES PERT
Locally applied patches:
MAINT18379
Built under linux
Compiled at Feb 1 2005 09:37:17
@INC:
/usr/lib/perl5/5.8.0/i386-linux-thread-multi
/usr/lib/perl5/5.8.0
/usr/lib/perl5/site_perl/5.8.0/i386-linux-thread-multi
/usr/lib/perl5/site_perl/5.8.0
/usr/lib/perl5/site_perl
/usr/lib/perl5/vendor_perl/5.8.0/i386-linux-thread-multi
/usr/lib/perl5/vendor_perl/5.8.0
/usr/lib/perl5/vendor_perl
/usr/lib/perl5/5.8.0/i386-linux-thread-multi
/usr/lib/perl5/5.8.0


[root@qrhqz001 bin]# perl -v

This is perl, v5.8.0 built for i386-linux-thread-multi
(with 1 registered patch, see perl -V for more detail)

Copyright 1987-2002, Larry Wall

Perl may be copied only under the terms of either the Artistic License or the
GNU General Public License, which may be found in the Perl 5 source kit.

Complete documentation for Perl, including FAQ lists, should be found on
this system using `man perl' or `perldoc perl'. If you have access to the
Internet, point your browser at http://www.perl.com/, the Perl Home Page.

[root@qrhqz001 bin]#
A. Clay Stephenson
Acclaimed Contributor

Re: perl FTP scripts (A. Clay Stephenson)

The Net::FTP module can only report what the underlying ftpd daemon returns as a status. Evidently you have found an ftp server that reports a status '2' (good) when no ls() matches are found. The 'fix' is trivially easy and you should have been able to handle this yourself. All you have to do is examine the number of items stored in @tmp_array by the ls() method and if $#tmp_array < 0 then set the status to a non-zero value. In Perl, $#array_name contains the index of the last member @array_name and the arrays are zero-based. Therefore $#array_name for an empty array would be set to -1. In any event, version 1.31 addresses your problem.



If it ain't broke, I can fix that.
Jeganraj
Occasional Advisor

Re: perl FTP scripts (A. Clay Stephenson)

Thanks ACS,

Its working perfectly now. Thanks. I never used perl and started studing. Hope next troubleshooting i could do it.

J.Marlose.