1

我有一些不规律的工作要做(经常和很多),所以我不能使用 crontab。

例如:

  • 2012 年 7 月 22 日上午 10:20 发送电子邮件
  • 今晚11点发一篇文章
  • 明天上午 9:50 运行脚本。

我找到了 linux commond at,但这不容易管理,否则,我搜索了一些消息队列(如 zeromq)和 gearman,它们也无法执行预定作业或延迟作业。

还有其他解决方案吗?

4

2 回答 2

0

不幸的是,您的选择是 cron 或手动管理睡眠。

但是,如果您使用的是 Django,这已经为您完成了

于 2011-07-12T03:01:21.930 回答
0

APScheduler怎么样?

import time
from datetime import datetime
from apscheduler.scheduler import Scheduler

# Schedule my_job for year, month, day, hour (out of 24), minute.  Then wait.
sched = Scheduler()
sched.start()
def my_job(text):  print text
job = sched.add_date_job(my_job, datetime(2011, 7, 11, 22, 04), ['hello'])
while True:
  print datetime.now()
  time.sleep(1)
于 2011-07-12T03:04:23.177 回答