Python脚本在crontab下不起作用

时间:2013-01-28 23:41:27

标签: python linux ubuntu cron

我有一个非常基本的python脚本,可以每分钟运行一次crontab。

剧本

filed = open('test.txt','a')

Crontab

* * * * * /to path the file/job.py

它应该有效,但我无法看到结果。那么,可能是什么问题呢?

1 个答案:

答案 0 :(得分:6)

您需要使用绝对路径打开text.txt; crondaemon可能正在使用与你期望的不同的路径:

filed = open('/home/john/Desktop/test.txt','a')