【发布时间】:2013-07-17 00:35:27
【问题描述】:
我在 contab 中添加了以下行
1 * * * * /usr/bin/python /home/prkumar/Desktop/python/sample.py
我的 sample.py 文件
text_file = open("sample.log", "a")
text_file.write("Hi...")
text_file.write("\n")
text_file.close()
如果我在终端中运行 python 程序,它工作正常,并将文本附加到 sample.log 文件中。但是在crontab中添加程序没有反应。
谢谢
【问题讨论】:
-
也许以 python shebang 作为第一行? en.wikipedia.org/wiki/Shebang_(Unix)#Examples
标签: python linux python-2.7 crontab