可以像使用linux下cron那样使用twisted的scheduling.
http://code.google.com/p/twistedcronservice/
不过我更喜欢用twisted自己的Scheduling utility
http://twistedmatrix.com/trac/browser/trunk/twisted/internet/task.py
加上Cooperator, CooperatorServer, Application, 齐了。
下一篇我会写一个完整的实例。
import sys
from twisted.python import log
#need to import reactor
log.startLogging(sys.stdout)
from twisted.application import internet, service
from twistedschedule.cron import CronSchedule
from twistedschedule.task import ScheduledCall
def test():
log.msg('calling from scheduler...')
schedule = CronSchedule('* * * * *') #every minute.
sc = ScheduledCall(test)
sc.start(schedule)
reactor.run()