-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
36c5590
commit 5bf5276
Showing
1 changed file
with
9 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,17 @@ | ||
from django_apscheduler.jobstores import DjangoJobStore, register_events | ||
from apscheduler.schedulers.background import BackgroundScheduler | ||
from .utils.django_email_server import __send__rebate__email__ | ||
import sys, socket | ||
|
||
def start(): | ||
try: | ||
sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM) | ||
sock.bind(("127.0.0.1", 47200)) | ||
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() | ||
scheduler.start() | ||
print, "scheduler started" |