I have a low traffic internal webpage for which we use for the management of remote computers.
This webpage attempts to register a CRON job, so that once a week at a specified time, an e-mail will be sent to a list, with the current status of the data from the database.
However, in testing, everything appeared fine. When pushing to production, I would test the cron job, it would work. But when leaving the system running over the weekend ( when possibly no one is on the system), the job does not get executed.
I have tried initializing in a few different ways, so that it wouldn't (shouldn't) be tied to any requests on the system, and should register at initialization, regardless of if anyone has hit the system.
mmsver.wsgi
from flask_apscheduler.scheduler import APScheduler
from nydps.web.mmserver import app as application
scheduler = APScheduler()
scheduler.init_app(application)
scheduler.start()
mmserver.py (excerpt)
def weekly_report():
# doing things with a session
# send_smtp is a custom smtp function
send_smtp(smtp_content, destination, smtpSender, 'TMM Directory: Weekly Utilization Report')
app.config['JOBS'] = [{
'id': 'weekly_report',
'func': weekly_report,
'trigger': {
'type': 'cron',
'day_of_week': weekly_report_day_of_week,
'hour': weekly_report_hour,
'minute': weekly_report_minute
}
}]
If I go change the report day, hour, minute. Restart the server, it will execute. Only when I set the day hour minute to a time in the slightly further future (where I am not actively on the site), it doesnt appear to be executed.
Any thoughts?
Edit: Production is deployed behind Apache using WAMP on Windows.