python - APScheduler not starting? -


i run python script during night , thinking of using apscheduler. i'll start running @ 1am of following night , run once every night

my scheduler script looks (scheduler.py):

from apscheduler.scheduler import scheduler datetime import datetime, timedelta, time, date  def myscript():     print "ok"  if __name__ == '__main__':     sched = scheduler()     startdate = datetime.combine(date.today() + timedelta(days=1),time(1))     sched.start()     sched.add_interval_job(myscript, start_date = startdate, days=1) 

in shell, do: python myscheduler.py & disown (i'm running remotely, want run in background , disown it. immediately, number (pid) appears below line, every other python script do. when ps -e | grep python, number not there. tried kill -9 pid , got message saying job not exist.

is scheduler running? if yes, how can stop it? if not, doing wrong?

you have keep script running otherwise after sched.add_interval_job(myscript, start_date = startdate, days=1), script ends , stop. add

import time  while true:     time.sleep(10) sched.shutdown() 

after, , then, scheduler still alive.


Comments

Popular posts from this blog

objective c - Change font of selected text in UITextView -

php - Accessing POST data in Facebook cavas app -

c# - Getting control value when switching a view as part of a multiview -