From 75e503ef42d4ef8428f2a5cd046a3a01d477db56 Mon Sep 17 00:00:00 2001 From: Shridhar Date: Fri, 19 Jan 2018 15:15:12 +0530 Subject: [PATCH 1/2] Documentation for Cron like events scheduler --- frappe/docs/user/en/guides/basics/hooks.md | 23 ++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/frappe/docs/user/en/guides/basics/hooks.md b/frappe/docs/user/en/guides/basics/hooks.md index 9fb71f7800..866e0ebb20 100755 --- a/frappe/docs/user/en/guides/basics/hooks.md +++ b/frappe/docs/user/en/guides/basics/hooks.md @@ -260,6 +260,7 @@ Scheduler hooks are methods that are run periodically in background. Structure f * `monthly_long` * `hourly` * `all` +* `cron` The scheduler events require celery, celerybeat and redis (or a supported and configured broker) to be running. The events with suffix '\_long' are for long @@ -275,3 +276,25 @@ Example, "erpnext.setup.doctype.backup_manager.backup_manager.take_backups_daily" ], } + +#### Cron Like Scheduler + +Schedule methods to be executed periodically + +Example, + + scheduler_events = { + "cron": { + "15 18 * * *": [ + "frappe.twofactor.delete_all_barcodes_for_users" + ], + "*/6 * * * *": [ + "frappe.utils.error.collect_error_snapshots" + ], + "annual": [ + "frappe.utils.error.collect_error_snapshots" + ] + } + } + +The asterisk (*) operator specifies all possible values for a field. For example, an asterisk in the hour time field would be equivalent to every hour or an asterisk in the month field would be equivalent to every month. \ No newline at end of file From 2d164ca70f86fd6909e5cfd8cc7e0fb1b8d9c5dd Mon Sep 17 00:00:00 2001 From: Shridhar Date: Fri, 19 Jan 2018 15:53:08 +0530 Subject: [PATCH 2/2] Scheduler hooks event cron --- frappe/docs/user/en/guides/basics/hooks.md | 9 --------- 1 file changed, 9 deletions(-) diff --git a/frappe/docs/user/en/guides/basics/hooks.md b/frappe/docs/user/en/guides/basics/hooks.md index 866e0ebb20..0540b7b39a 100755 --- a/frappe/docs/user/en/guides/basics/hooks.md +++ b/frappe/docs/user/en/guides/basics/hooks.md @@ -275,15 +275,6 @@ Example, "{daily_long}": [ "erpnext.setup.doctype.backup_manager.backup_manager.take_backups_daily" ], - } - -#### Cron Like Scheduler - -Schedule methods to be executed periodically - -Example, - - scheduler_events = { "cron": { "15 18 * * *": [ "frappe.twofactor.delete_all_barcodes_for_users"