duanbai1974 2014-05-04 13:48
浏览 85

perl脚本没有通过cron运行

I need your help here. I wrote one PERL script for PHP application which needs to be run for every 5 mins. This script will call PHP program, which will fetch data from MySQL DB and will generate a excel report and will mail those reports to specific users. Every thing seems to be fine when I ran this script manually with the command (perl reports.pl). But when I set this Perl in a cron tab, nothing works and reports are not getting generated.

Details: perl script path /opt/app/deweb/web/EDI/Microsoft/reports.pl

this script will call PHP program (/opt/app/deweb/web/EDI/Microsoft/reports.php)

content of script
#!/usr/local/bin/perl
use Net::FTP;
use File::Copy;
use POSIX;
@errorreport = `php /opt/app/deweb/web/EDI/Microsoft/reports.php`;
print "@errorreport
";
exit;

It is working perfectly when running Manually using command - perl reports.pl

No results, when set in CRON:

*/5 7-19 * * * /usr/local/bin/perl /opt/app/deweb/web/EDI/Microsoft/reports.pl

Please note that this crontab is under super user account named webserv and my login is having access to edit under this super user account. I'm editing this cron tab using command :: sudo -u webserv crontab -e

  • 写回答

2条回答 默认 最新

  • duanliang1019 2014-05-04 15:56
    关注

    I would check the following:

    1. Does it run using sudo -u webserv perl reports.pl? If not, fix the problem for the webserv user (permissions or whatever) and it should work via cron too.
    2. Does which perl using your login give you /usr/local/bin/perl? If not, change the path to Perl in crontab to what you got in which perl to fix the problem.
    评论

报告相同问题?

悬赏问题

  • ¥15 数学建模招标中位数问题
  • ¥15 phython路径名过长报错 不知道什么问题
  • ¥15 深度学习中模型转换该怎么实现
  • ¥15 HLs设计手写数字识别程序编译通不过
  • ¥15 Stata外部命令安装问题求帮助!
  • ¥15 从键盘随机输入A-H中的一串字符串,用七段数码管方法进行绘制。提交代码及运行截图。
  • ¥15 TYPCE母转母,插入认方向
  • ¥15 如何用python向钉钉机器人发送可以放大的图片?
  • ¥15 matlab(相关搜索:紧聚焦)
  • ¥15 基于51单片机的厨房煤气泄露检测报警系统设计