混淆我的Cron工作 [英] Confused with my Cron job
问题描述
我有一个perl脚本,我计划每分钟运行。
我已将cron作业设置为
* * * * * PATH = / usr / local / bin: usr / bin:/ usr / sbin:/ usr / lib; perl /dm2/www/html/isos/pre5.3/autoDownload.pl
我假设脚本正在执行每一分钟,因为我看到一个条目,当我在/ var / log /
中的cat cron下面 :57:01 dmvbu-build crond [773]:(root)CMD(PATH = / usr / local / bin:/ usr / bin:/ usr / sbin:/ usr / lib; perl / dm2 / www / html / isos /pre5.3/autoDownload.pl)
Jul 26 04:58:01 dmvbu-build crond [687]:(root)CMD(PATH = / usr / local / bin:/ usr / bin :/ usr / sbin:/ usr / lib; perl /dm2/www/html/isos/pre5.3/autoDownload.pl)
但我的问题是我有像
打印LOG连接到网站\\
其中LOG是名为log.txt的文件的文件描述符,位于
dm2 / www / html / isos / pre5.3 /(与autoDownload.pl相同)
但我没看到这个log.txt文件更新后的新信息请参阅cron日志文件中的条目
但是当我手动运行代码时,我看到此文件更新
cron
行应为
* * * * * PATH = / usr / local / bin:/ usr / bin:/ usr / sbin:/ usr / lib perl /dm2/www/html/isos/pre5.3/autoDownload.pl
$注意在
=
之后缺少空格,而且在之前缺少分号; perl
。I have a perl script which Im planning to run every minute. I have set the cron job as
* * * * * PATH= /usr/local/bin:/usr/bin:/usr/sbin:/usr/lib; perl /dm2/www/html/isos/pre5.3/autoDownload.pl
I assume the script is executing every minute only because I see a entry like below when I do cat cron in /var/log/
Jul 26 04:57:01 dmvbu-build crond[773]: (root) CMD (PATH= /usr/local/bin:/usr/bin:/usr/sbin:/usr/lib; perl /dm2/www/html/isos/pre5.3/autoDownload.pl) Jul 26 04:58:01 dmvbu-build crond[687]: (root) CMD (PATH= /usr/local/bin:/usr/bin:/usr/sbin:/usr/lib; perl /dm2/www/html/isos/pre5.3/autoDownload.pl)
But my problem is I have statements like
print LOG "connecting to website\n"
where LOG is a file descriptor to a file named log.txt which is located at dm2/www/html/isos/pre5.3/ (same place as autoDownload.pl)
But I dont see this log.txt file updating with new informations after I see the entry in the cron log file But I see this file updating when I run the code manually
解决方案The
cron
line should be* * * * * PATH=/usr/local/bin:/usr/bin:/usr/sbin:/usr/lib perl /dm2/www/html/isos/pre5.3/autoDownload.pl
Note the lack of a space after the
=
and the lack of a semicolon beforeperl
.这篇关于混淆我的Cron工作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!