Bug 20897 - Add generic cronjob to run plugins with a 'cronjob' method
Summary: Add generic cronjob to run plugins with a 'cronjob' method
Status: Signed Off
Alias: None
Product: Koha
Classification: Unclassified
Component: Command-line Utilities (show other bugs)
Version: master
Hardware: All All
: P5 - low enhancement (vote)
Assignee: paxed
QA Contact: Testopia
URL:
Keywords:
Depends on:
Blocks: 24668
  Show dependency treegraph
 
Reported: 2018-06-07 17:46 UTC by Nick Clemens
Modified: 2020-02-14 21:00 UTC (History)
4 users (show)

See Also:
Change sponsored?: ---
Patch complexity: ---
Who signed the patch off:
Text to go in the release notes:
Version(s) released in:


Attachments
Bug 20897: Add generic cronjob to run plugins with a cronjob method (4.61 KB, patch)
2020-02-13 10:22 UTC, paxed
Details | Diff | Splinter Review
Plugin to test Bug 20897 (1.29 KB, application/zip)
2020-02-13 10:24 UTC, paxed
Details
Bug 20897: Add generic cronjob to run plugins with a cronjob method (4.66 KB, patch)
2020-02-14 19:07 UTC, Liz Rea
Details | Diff | Splinter Review
Bug 20897 - add commented cron example to cron.hourly (1008 bytes, patch)
2020-02-14 19:07 UTC, Liz Rea
Details | Diff | Splinter Review

Note You need to log in before you can comment on or make changes to this bug.
Description Nick Clemens 2018-06-07 17:46:51 UTC
Sometimes there are ad-hoc cronjobs that need to be setup for a site, or there are plugins that need some regular tasks done.

I was thinking an easy solution might be to package a generic cronjob into koha that would run daily (or whenever) to check for plugins with a cronjob method.

The plugins could allow for configuration of the job in their configure method so that users could have control over some jobs. Could be used for emailing reports or other things that might benefit from a user facing solution.
Comment 1 paxed 2020-02-13 10:22:48 UTC
Created attachment 98803 [details] [review]
Bug 20897: Add generic cronjob to run plugins with a cronjob method
Comment 2 paxed 2020-02-13 10:24:18 UTC
Created attachment 98804 [details]
Plugin to test Bug 20897

This is a plugin to test bug 20897. All it does it implement the cronjob-method, and in that method, logs a warning: "PLUGIN Bug20897: CRONJOB"
Comment 3 Liz Rea 2020-02-14 19:07:43 UTC
Created attachment 99017 [details] [review]
Bug 20897: Add generic cronjob to run plugins with a cronjob method

This adds a run_cronjob_plugins.pl script, which will run the
cronjob-methods of the installed plugins.

Test plan:
1) Enable plugins, upload the Bug20897 test plugin
2) Set up the run_cronjob_plugins.pl in cronjob
3) Check the cron logs to see the message "PLUGIN Bug20897: CRONJOB"
   shows up there every time the cronjob is run
4) Test that the plugins-home.pl -page can filter the cronjob plugins

Signed-off-by: Pasi Kallinen <pasi.kallinen@koha-suomi.fi>

Signed-off-by: Liz Rea <wizzyrea@gmail.com>
Comment 4 Liz Rea 2020-02-14 19:07:51 UTC
Created attachment 99018 [details] [review]
Bug 20897 - add commented cron example to cron.hourly

To test:
Have a look at kohaclone/debian/koha-common.cron.hourly, see that there
is a job in there for running the plugin cron jobs for every Koha
instance.

Signed-off-by: Liz Rea <wizzyrea@gmail.com>