From 11794265bbc0c9daf65d82d07dcbd7e1f02f96a7 Mon Sep 17 00:00:00 2001 From: Kyle M Hall Date: Mon, 4 Dec 2023 12:41:32 -0500 Subject: [PATCH] Bug 35479: Log start, end, and any failures for each plugin's nightly cronjob When running the plugins_nightly.pl cronjob, we should record the plugins that have a nightly method, logging the start and end of each plugins routine Test Plan: 1) Enable CronjobLog 2) Install a plugin with a nightly cronjob ( e.g. https://github.com/bywatersolutions/koha-plugin-book-list-printer ) 3) Run plugins_nightly.pl 4) Note new entries in the cronjob viewer for the start and end of the plugin's nightly cronjob run 5) Edit the plugin, add a line like "die 'this is a test';" to the plugin's nightly cronjob 6) Run plugins_nightly.pl 7) View the action logs, not the log for the error you added! Signed-off-by: Pedro Amorim --- misc/cronjobs/plugins_nightly.pl | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/misc/cronjobs/plugins_nightly.pl b/misc/cronjobs/plugins_nightly.pl index 218ed13fc0..9816d19bda 100755 --- a/misc/cronjobs/plugins_nightly.pl +++ b/misc/cronjobs/plugins_nightly.pl @@ -22,10 +22,14 @@ if ( C4::Context->config("enable_plugins") ) { ); foreach my $plugin (@plugins) { + my $plugin_name = ref $plugin; try { + cronlogaction({ info => "running nightly cronjob for plugin $plugin_name" }); $plugin->cronjob_nightly(); + cronlogaction({ info => "finished nightly cronjob for plugin $plugin_name" }); } catch { + cronlogaction({ info => "failed to running nightly cronjob for plugin $plugin_name with error: $_" }); warn "$_"; $logger->warn("$_"); }; -- 2.30.2