diff --git a/home/schedulers.py b/home/schedulers.py index 6ad3096..cf1ce7e 100644 --- a/home/schedulers.py +++ b/home/schedulers.py @@ -9,9 +9,10 @@ except socket.error: print, "!!!scheduler already started, DO NOTHING" else: - scheduler = BackgroundScheduler() - scheduler.add_jobstore(DjangoJobStore(), "default") - scheduler.add_job(__send__rebate__email__, 'cron', hour=23, minute=59, second=0) - register_events(scheduler) - scheduler.start() - print, "scheduler started" + def start(): + scheduler = BackgroundScheduler() + scheduler.add_jobstore(DjangoJobStore(), "default") + scheduler.add_job(__send__rebate__email__, 'cron', hour=23, minute=59, second=0) + register_events(scheduler) + scheduler.start() + print, "scheduler started"