1

I have some irregular jobs to do(frequent and many), so I can't use the crontab.

for example:

  • send an email at 10:20AM on July 22 2012
  • post a article at 11PM tonight
  • run a script at 9:50AM tomorrow.

I found the linux commond at, but that can't be managed easily, otherwise, I search some message queue (like zeromq) and gearman, they can't do scheduled jobs or delayed jobs too.

Are there other solutions?

hlovdal
  • 23,353
  • 10
  • 78
  • 148
lostsnow
  • 23
  • 2

2 Answers2

0

Unfortunately, your choice is cron or manually manage sleep.

If you're using Django, however, this has already been accomplished for you.

cwallenpoole
  • 72,280
  • 22
  • 119
  • 159
0

How about 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)
Jesse Aldridge
  • 7,134
  • 7
  • 41
  • 72