python – 非时间特定的一天crontab?

我有一个
python脚本,我希望每天只运行一次.

我对crontab命令做了一些研究,似乎这样做了,但是每天都在固定的时间.

问题是我的计算机不会整天运行,并且运行它的具体时间是不可能的.我能做什么?

日志文件可以帮助吗?我想每隔5分钟左右做一次crontab并扫描日志文件以查看当天的任何运行.

最佳答案 安装
anacron,这是一个cron调度程序,可以处理计算机启动时每天最多运行一次的任务.

来自WikiPedia页面:

anacron is a computer program that performs periodic command scheduling which is traditionally done by cron, but without assuming that the system is running continuously. Thus, it can be used to control the execution of daily, weekly, and monthly jobs (or anything with a period of n days) on systems that don’t run 24 hours a day.

点赞