对cron

时间:2017-06-10 14:45:33

标签: java perl cron

我正在尝试通过cron作业执行perl脚本,该作业使用system命令为boilerpipe执行java包装器。它通过cron执行时失败。脚本(简化)是

my $link = "http://foo.bar"; # with a real link
my $cmdstring = 'java -jar boilerpipe-wrapper.jar url '.$link.' out.txt';
my $result = system($cmdstring);
if ($? == -1) {
    print LOG "failed to execute system command: $!\n";
    die;
}
elsif ($? & 127) {
    printf LOG "child died with signal %d, %s coredump\n",
        ($? & 127),  ($? & 128) ? 'with' : 'without';
    die;
}
else {
    printf LOG "child exited with value %d\n", $? >> 8;
    die;
}

die命令在那里用于调试目的。 LOG中出现的内容是

child exited with value 1

crontab行是

24 7 * * * perl /home/retrievetext.pl >> /home/cron-msgs 2>&1

cron-msgs中出现的内容是

Error: unable to access jarfile boilerpipe-wrapper.jar
Died at /home/retrievetext.pl line 15

boilerpipe-wrapper.jar的ls -la是

-rwxr-xr-x 1 steve sudo 1945275 Apr 29 03:53 boilerpipe-wrapper.jar

从终端执行时,Perl脚本和系统调用按预期工作。有谁知道问题是什么?

0 个答案:

没有答案