我有一个运行另一个 python 脚本的 python 脚本。 “其他脚本”(正在运行的脚本)需要大约 45[分钟] 才能完成。
当“执行”脚本从 Ubuntu 的 shell 运行时,一切都运行良好。
我向 cron 添加了一个条目来运行“执行”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 运行时通常会出现一些常见的误解。
- 没有会议。如果您的代码需要会话,则必须进行额外的设置。
- 用户会话和 cron 执行环境之间的 PATH 和其他环境变量几乎总是不同的。
当 cron 失败时,它会默认尝试发送邮件。您可以在本地邮箱或队列(如果您的 mta 已关闭)中查找错误。
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)