如何在特定时间启动/停止脚本?

时间:2012-09-04 15:03:33

标签: python-2.7

我编写了一个实时读取日志文件的脚本。我遇到的问题是该日志文件的位置每隔午夜更改,相同的文件名不同的文件夹。

我可以重新生成文件位置路径,但我不知道如何启动/停止脚本来重新处理日志文件?现在我正在手工做。

1 个答案:

答案 0 :(得分:0)

我的建议是

(a) If it's a linux box, why not run a "cron" job (which will stop and start the script)
(b) Alternatively, in your code, detect when the file can no longer be read, then switch folders
相关问题