繁体   English   中英

Python脚本不通过Cron工作?

[英]Python Script Not Working Via Cron?

我有一个运行另一个python脚本的python脚本。 “其他脚本”(正在运行的脚本)需要大约45 [min]才能完成。

当'执行'脚本从Ubuntu的shell运行时,它完全正常。

我在cron中添加了一个条目来运行'execution'python脚本。 它似乎首先运行,但程序在几秒后终止:


user@internet:~/REMOTE_CONTROL$ ps aux | grep python
user      1603  0.0  1.4  31504 15184 ?        S    22:50   0:00 python /usr/share/system-config-printer/applet.py

root      1714  0.0  0.7  13672  8012 ?        S    22:51   0:00 /usr/bin/python /usr/lib/system-service/system-service-d

**user      7956  109  1.0  14380 10692 ?        R    23:48   0:01 python /media/READ_ONLY/DEVELOPER/COMPOSITE/CURRENT/DataLoader.py**

user      8029  0.0  0.0   3320   788 pts/1    S+   23:48   0:00 grep --color=auto python
user@internet:~/REMOTE_CONTROL$ ps aux | grep python

user      1603  0.0  1.4  31504 15184 ?        S    22:50   0:00 python /usr/share/system-config-printer/applet.py

root      1714  0.0  0.7  13672  8012 ?        S    22:51   0:00 /usr/bin/python /usr/lib/system-service/system-service-d

**user      7956  100  1.1  15448 11900 ?        R    23:48   0:07 python /media/READ_ONLY/DEVELOPER/COMPOSITE/CURRENT/DataLoader.py**

user      8033  0.0  0.0   3320   788 pts/1    S+   23:48   0:00 grep --color=auto python
user@internet:~/REMOTE_CONTROL$ ps aux | grep python

user      1603  0.0  1.4  31504 15184 ?        S    22:50   0:00 python /usr/share/system-config-printer/applet.py

root      1714  0.0  0.7  13672  8012 ?        S    22:51   0:00 /usr/bin/python /usr/lib/system-service/system-service-d

**user      7956 97.2  1.2  15992 12412 ?        R    23:48   0:11 python /media/READ_ONLY/DEVELOPER/COMPOSITE/CURRENT/DataLoader.py**

user      8035  0.0  0.0   3320   792 pts/1    S+   23:48   0:00 grep --color=auto python
user@internet:~/REMOTE_CONTROL$ ps aux | grep python

user      1603  0.0  1.4  31504 15184 ?        S    22:50   0:00 python /usr/share/system-config-printer/applet.py

root      1714  0.0  0.7  13672  8012 ?        S    22:51   0:00 /usr/bin/python /usr/lib/system-service/system-service-d

user      8037  0.0  0.0   3320   792 pts/1    S+   23:48   0:00 grep --color=auto python

知道我可能会缺少什么吗? 我试图替换“执行”脚本触发的脚本,并让它调用一个简单的脚本,它只执行以下操作:

while(1):

....print "hi"

它仍然无法正常工作。

有任何想法吗? 谢谢。

(我使用的是Ubuntu 10.04 LTS)

在尝试从cron运行时,通常会产生一些常见的误解。

  • 没有会话。 如果您有需要会话的代码,则必须进行其他设置。
  • PATH和其他环境变量在用户会话和cron执行环境之间几乎总是不同的。

当cron失败时,它将默认尝试发送邮件。 您可以查看本地邮箱或队列(如果您的mta已关闭)以查找错误。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM