M
mparker
I posted all of my code below for easy reference. I have this code
setup to connect to an FTP server and download some files. It works
great when I login as root. However, when I run this in cron I get the
error below. I set the directory permissions to 0777 just to see if it
would work and I get the same error.
Does anyone have any thoughts or any recommendations on what I can
look at to begin troubleshooting?
Thanks in advance!
Errors:
Cannot open Local file agents.txt: Permission denied
at /var/www/vhosts/domain.com/httpdocs/realcomp/idx.pl line 12
Cannot open Local file commercial.txt: Permission denied
at /var/www/vhosts/domain.com/httpdocs/realcomp/idx.pl line 13
Cannot open Local file condominium.txt: Permission denied
at /var/www/vhosts/domain.com/httpdocs/realcomp/idx.pl line 14
Cannot open Local file multifamily.txt: Permission denied
at /var/www/vhosts/domain.com/httpdocs/realcomp/idx.pl line 15
Cannot open Local file offices.txt: Permission denied
at /var/www/vhosts/domain.com/httpdocs/realcomp/idx.pl line 16
Cannot open Local file residential.txt: Permission denied
at /var/www/vhosts/domain.com/httpdocs/realcomp/idx.pl line 17
Cannot open Local file vacantland.txt: Permission denied
at /var/www/vhosts/domain.com/httpdocs/realcomp/idx.pl line 18
Cannot open Local file photos.txt: Permission denied
at /var/www/vhosts/domain.com/httpdocs/realcomp/idx.pl line 26
Cannot open Local file openhouse.txt: Permission denied
at /var/www/vhosts/domain.com/httpdocs/realcomp/idx.pl line 34
Code:
#!/usr/bin/perl
use Net::FTP;
my $ftp = Net::FTP->new("ftp.domain.com", Debug => 0);
$ftp->login("username", "password");
my @file_list = $ftp->ls();
foreach (@file_list) {
$ftp->get($_, 'agents.txt') if ( $_ =~ m/idxag.*?\.txt/ );
$ftp->get($_, 'commercial.txt') if ( $_ =~ m/idxcm.*?
\.txt/ );
$ftp->get($_, 'condominium.txt') if ( $_ =~ m/idxcn.*?
\.txt/ );
$ftp->get($_, 'multifamily.txt') if ( $_ =~ m/idxmf.*?
\.txt/ );
$ftp->get($_, 'offices.txt') if ( $_ =~ m/idxof.*?\.txt/ );
$ftp->get($_, 'residential.txt') if ( $_ =~ m/idxrs.*?
\.txt/ );
$ftp->get($_, 'vacantland.txt') if ( $_ =~ m/idxvl.*?
\.txt/ );
}
$ftp->cwd("/photoext");
my @file_list = $ftp->ls();
foreach (@file_list) {
$ftp->get($_, 'photos.txt') if ( $_ =~ m/photos.*?\.txt/ );
}
$ftp->cwd("/OpenHouse");
my @file_list = $ftp->ls();
foreach (@file_list) {
$ftp->get($_, 'openhouse.txt') if ( $_ =~ m/openhouse.*?
\.txt/ );
}
$ftp->quit;
setup to connect to an FTP server and download some files. It works
great when I login as root. However, when I run this in cron I get the
error below. I set the directory permissions to 0777 just to see if it
would work and I get the same error.
Does anyone have any thoughts or any recommendations on what I can
look at to begin troubleshooting?
Thanks in advance!
Errors:
Cannot open Local file agents.txt: Permission denied
at /var/www/vhosts/domain.com/httpdocs/realcomp/idx.pl line 12
Cannot open Local file commercial.txt: Permission denied
at /var/www/vhosts/domain.com/httpdocs/realcomp/idx.pl line 13
Cannot open Local file condominium.txt: Permission denied
at /var/www/vhosts/domain.com/httpdocs/realcomp/idx.pl line 14
Cannot open Local file multifamily.txt: Permission denied
at /var/www/vhosts/domain.com/httpdocs/realcomp/idx.pl line 15
Cannot open Local file offices.txt: Permission denied
at /var/www/vhosts/domain.com/httpdocs/realcomp/idx.pl line 16
Cannot open Local file residential.txt: Permission denied
at /var/www/vhosts/domain.com/httpdocs/realcomp/idx.pl line 17
Cannot open Local file vacantland.txt: Permission denied
at /var/www/vhosts/domain.com/httpdocs/realcomp/idx.pl line 18
Cannot open Local file photos.txt: Permission denied
at /var/www/vhosts/domain.com/httpdocs/realcomp/idx.pl line 26
Cannot open Local file openhouse.txt: Permission denied
at /var/www/vhosts/domain.com/httpdocs/realcomp/idx.pl line 34
Code:
#!/usr/bin/perl
use Net::FTP;
my $ftp = Net::FTP->new("ftp.domain.com", Debug => 0);
$ftp->login("username", "password");
my @file_list = $ftp->ls();
foreach (@file_list) {
$ftp->get($_, 'agents.txt') if ( $_ =~ m/idxag.*?\.txt/ );
$ftp->get($_, 'commercial.txt') if ( $_ =~ m/idxcm.*?
\.txt/ );
$ftp->get($_, 'condominium.txt') if ( $_ =~ m/idxcn.*?
\.txt/ );
$ftp->get($_, 'multifamily.txt') if ( $_ =~ m/idxmf.*?
\.txt/ );
$ftp->get($_, 'offices.txt') if ( $_ =~ m/idxof.*?\.txt/ );
$ftp->get($_, 'residential.txt') if ( $_ =~ m/idxrs.*?
\.txt/ );
$ftp->get($_, 'vacantland.txt') if ( $_ =~ m/idxvl.*?
\.txt/ );
}
$ftp->cwd("/photoext");
my @file_list = $ftp->ls();
foreach (@file_list) {
$ftp->get($_, 'photos.txt') if ( $_ =~ m/photos.*?\.txt/ );
}
$ftp->cwd("/OpenHouse");
my @file_list = $ftp->ls();
foreach (@file_list) {
$ftp->get($_, 'openhouse.txt') if ( $_ =~ m/openhouse.*?
\.txt/ );
}
$ftp->quit;