Wow.. why would they do that?
On 10/3/2013 8:35 PM, Ski Kacoroski wrote:
Thanks to everyone who responded. The issue (other than the pathetic
perl code) was that lftp does change behavior when run under cron and
there is an option to have consistent behavior for cron and a
terminal. I will also work on cleaning up the perl code - thanks for
all your advice.
cheers,
ski
On 10/03/2013 09:23 AM, Ski Kacoroski wrote:
Hi,
I have a simple perl script that creates some csv files and uploads them
to a vendor. The problem code is:
sub UploadCSV {
my $results = `/usr/bin/lftp -e "mput
/var/spool/discoveryed/*.csv;bye" -u ZZZZZZZZ,'YYYYY'
transfer.discoveryeducation.com 2>&1`;
print "ftp return: $results\n";
if ( $results =~ /Total 4 files transferred/) {
print "Discovery Education Upload Ok\n\n$results";
`rm /var/spool/discoveryed/old/*`;
`mv /var/spool/discoveryed/*roster*.csv
/var/spool/discoveryed/roster.prev`;
`mv /var/spool/discoveryed/*.csv /var/spool/discoveryed/old`;
} else {
print "Discovery Education Upload Failed\n\n$results";
}
}
My output from the cron job is:
ftp return:
Discovery Education Upload Failed
However in reality, the upload was successful (I can see the files on
the vendors site. When I run it from the command link the $results are:
webapp:/opt/ski# ./DiscoveryEducation.pl
ftp return: 7452635 bytes transferred in 16 seconds (449.3K/s)
Total 4 files transferred
Discovery Education Upload Ok
7452635 bytes transferred in 16 seconds (449.3K/s)
Total 4 files transferred
Any ideas why the $results variable is not being set when the job is run
from cron or how I can debug this problem. I am using perl 5.10.0.
Thanks,
ski
_______________________________________________
Discuss mailing list
[email protected]
https://lists.lopsa.org/cgi-bin/mailman/listinfo/discuss
This list provided by the League of Professional System Administrators
http://lopsa.org/