Skip to content

Instantly share code, notes, and snippets.

@sakakendo
Created May 14, 2018 05:24
Show Gist options
  • Save sakakendo/e5460cf0c69fc2c89707acd832654850 to your computer and use it in GitHub Desktop.
Save sakakendo/e5460cf0c69fc2c89707acd832654850 to your computer and use it in GitHub Desktop.
>>> sche2018-05-14 14:02:00.002022every min2018-05-14 14:02:00.003023
sche2018-05-14 14:03:00.003838every min2018-05-14 14:03:00.005838
sche2018-05-14 14:04:00.007090every min2018-05-14 14:04:00.008587
sche2018-05-14 14:05:00.004284every min2018-05-14 14:05:00.005785
sche2018-05-14 14:06:00.004524every min2018-05-14 14:06:00.006040
sche2018-05-14 14:07:00.006065every min2018-05-14 14:07:00.006558
sche2018-05-14 14:08:00.004522every min2018-05-14 14:08:00.004522
sche2018-05-14 14:09:00.003951every min2018-05-14 14:09:00.004439
sche2018-05-14 14:10:00.004303every min2018-05-14 14:10:00.004817
sche2018-05-14 14:11:00.003570every min2018-05-14 14:11:00.003570
sche2018-05-14 14:12:00.003071every min2018-05-14 14:12:00.003571
sche2018-05-14 14:13:00.003573every min2018-05-14 14:13:00.004062
every min2018-05-14 14:14:00.003855sche2018-05-14 14:14:00.003355
sche2018-05-14 14:15:00.004306every min2018-05-14 14:15:00.004799
sche2018-05-14 14:16:00.005129every min2018-05-14 14:16:00.005629
sche2018-05-14 14:17:00.005026every min2018-05-14 14:17:00.005531
sche2018-05-14 14:18:00.003863every min2018-05-14 14:18:00.004363
every min2018-05-14 14:19:00.004692sche2018-05-14 14:19:00.004203
sche2018-05-14 14:20:00.004117every min2018-05-14 14:20:00.004618
every min2018-05-14 14:21:00.006377sche2018-05-14 14:21:00.005877
sche2018-05-14 14:22:00.009577every min2018-05-14 14:22:00.010077
every min2018-05-14 14:23:00.004861sche2018-05-14 14:23:00.004346
#!pip install apscheduler
import datetime
from pytz import utc
from apscheduler.schedulers.background import BackgroundScheduler
sched=BackgroundScheduler(timezone=utc)
def scheduled_job(mes=None):
print('')
sched.add_job(lambda : print('every min'+str(datetime.datetime.now())),'cron',minute="*")
sched.add_job(lambda : print('sche'+str(datetime.datetime.now())),'cron',hour="4",minute="50-59")
sched.add_job(lambda : print('sche'+str(datetime.datetime.now())),'cron',hour="5",minute="0-30")
sched.start()
print('app started'+str(datetime.datetime.now((pytz.timezone('UTC')))))
while True:pass
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment