Answer the question
In order to leave comments, you need to log in
Perl + Cron - why is the file not saved?
Hello!
There is a Perl script with this piece:
$msg .= "path: $fname \n";
unlink($fname);
unless (-d $_[2]) {mkdir 'in/'.$_[2], 0755;}
open(OUT,"> $fname") or $msg .= "$fname not save! \n";
local $/ = undef;
print OUT $content,"\n";
close(OUT);
*/20 * * * * root /usr/bin/perl *путь к файлу*
Answer the question
In order to leave comments, you need to log in
Here are a few options on how to win this:
1) You can add these lines to the script, somewhere on top.
BEGIN {
use Cwd 'chdir'; # Запуск скрипта из крона
use File::Basename;
chdir dirname $0; # Меняем путь
}
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question