0

Whew that is a long-winded title. But it explains my issue:

I have a crontab that runs a perl script.

That perl script runs a cap task, which outputs to STDOUT some status messages.

The perl script is supposed to capture the STDOUT (currently using backticks) from cap and parse it.

Now, this works 100% fine when I run the script from a bash user. However, when I run the script from a crontab, the perl script doesn't capture any output from the cap task.

Has anyone dealt with anything like this before? Thanks.

4

1 回答 1

1

也许您的 cap 可执行文件在没有向 stdout 发出任何消息的情况下死亡。您是否检查了执行的成功状态?

你能试试这个吗?

$check_result = `$cmd 2>&1`;
if ($?){
  die "$cmd failed with $check_result, $!";    
}
于 2013-09-18T08:40:10.620 回答