混淆我的Cron工作 [英] Confused with my Cron job

查看:140
本文介绍了混淆我的Cron工作的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个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 before perl.

这篇关于混淆我的Cron工作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆