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


--
"When we try to pick out anything by itself, we find it
 connected to the entire universe"            John Muir

Chris "Ski" Kacoroski, [email protected], 206-501-9803
or ski98033 on most IM services
_______________________________________________
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/

Reply via email to