Schedule jobs at particular date and/or time

@Suresh_Thakor:

Auto email report uses “daily_long” basis, but you can change in hooks.py to send it at specific hour.
In this example automail will be generated at 11.00am everyday.

(use bench migrate after change it)

scheduler_events = {
	"cron": {
		"0/15 * * * *": [
			"frappe.oauth.delete_oauth2_data",
			"frappe.website.doctype.web_page.web_page.check_publish_status",
			"frappe.twofactor.delete_all_barcodes_for_users",
		],
		"0/10 * * * *": [
			"frappe.email.doctype.email_account.email_account.pull",
		],
		# Hourly but offset by 30 minutes
		"30 * * * *": [
			"frappe.core.doctype.prepared_report.prepared_report.expire_stalled_report",
		],
		# Daily but offset by 45 minutes
		"45 0 * * *": [
			"frappe.core.doctype.log_settings.log_settings.run_log_clean_up",
		],
        # Daily at 11 am
        "0 11 * * *": [
            "frappe.email.doctype.auto_email_report.auto_email_report.send_daily",
		],
	},

Hope this helps.

1 Like