From 906d5b1a853b838706d41d28b5ae103d4bb54aa0 Mon Sep 17 00:00:00 2001 From: Nick Clemens Date: Fri, 5 Aug 2022 14:11:55 +0000 Subject: [PATCH] Bug 31203: Alter other cronjobs that currenlty use cronlogaction Added command line ooption logging and completion logging where cronlogaction was already imported. We should probably standardize all cronjobs, but this is a start One cron didn't log on confirm, likely we need to update all crons to log if confirm, and possibly not log if running in test mode? Another bug as well Signed-off-by: David Nind Signed-off-by: Marcel de Rooy Signed-off-by: Tomas Cohen Arazi --- koha-tmpl/intranet-tmpl/prog/js/datatables.js | 1 + misc/cronjobs/automatic_checkin.pl | 8 ++++++-- misc/cronjobs/automatic_item_modification_by_age.pl | 6 +++++- misc/cronjobs/automatic_renewals.pl | 6 +++++- misc/cronjobs/batch_anonymise.pl | 6 +++++- misc/cronjobs/build_browser_and_cloud.pl | 5 ++++- misc/cronjobs/cart_to_shelf.pl | 6 +++++- misc/cronjobs/cleanup_database.pl | 6 +++++- misc/cronjobs/cloud-kw.pl | 6 +++++- misc/cronjobs/delete_patrons.pl | 6 +++++- misc/cronjobs/fines.pl | 6 +++++- misc/cronjobs/gather_print_notices.pl | 6 +++++- misc/cronjobs/holds/auto_unsuspend_holds.pl | 5 ++++- misc/cronjobs/holds/build_holds_queue.pl | 4 +++- misc/cronjobs/holds/cancel_expired_holds.pl | 6 +++++- misc/cronjobs/holds/cancel_unfilled_holds.pl | 7 +++++++ misc/cronjobs/holds/holds_reminder.pl | 6 +++++- misc/cronjobs/longoverdue.pl | 6 +++++- misc/cronjobs/membership_expiry.pl | 6 +++++- misc/cronjobs/overdue_notices.pl | 5 ++++- misc/cronjobs/patron_emailer.pl | 8 ++++++-- misc/cronjobs/plugins_nightly.pl | 5 ++++- misc/cronjobs/process_message_queue.pl | 5 ++++- misc/cronjobs/purge_suggestions.pl | 7 ++++++- misc/cronjobs/recalls/expire_recalls.pl | 6 +++++- misc/cronjobs/recalls/overdue_recalls.pl | 6 +++++- misc/cronjobs/reconcile_balances.pl | 6 +++++- misc/cronjobs/runreport.pl | 6 +++++- misc/cronjobs/serialsUpdate.pl | 6 +++++- misc/cronjobs/share_usage_with_koha_community.pl | 6 +++++- misc/cronjobs/staticfines.pl | 5 ++++- misc/cronjobs/update_totalissues.pl | 6 +++++- 32 files changed, 153 insertions(+), 32 deletions(-) diff --git a/koha-tmpl/intranet-tmpl/prog/js/datatables.js b/koha-tmpl/intranet-tmpl/prog/js/datatables.js index fb55a9b271..bdf5a59741 100644 --- a/koha-tmpl/intranet-tmpl/prog/js/datatables.js +++ b/koha-tmpl/intranet-tmpl/prog/js/datatables.js @@ -545,6 +545,7 @@ jQuery.fn.dataTable.ext.errMode = function(settings, note, message) { 'beforeSend': function(xhr, settings) { this._xhr = xhr; if(options.embed) { + console.log(Array.isArray(options.embed)); xhr.setRequestHeader('x-koha-embed', Array.isArray(options.embed)?options.embed.join(','):options.embed); } if(options.header_filter && options.query_parameters) { diff --git a/misc/cronjobs/automatic_checkin.pl b/misc/cronjobs/automatic_checkin.pl index 2960b4a83d..c2708c851b 100755 --- a/misc/cronjobs/automatic_checkin.pl +++ b/misc/cronjobs/automatic_checkin.pl @@ -22,6 +22,10 @@ use Koha::Checkouts; use Koha::Script -cron; use C4::Log qw( cronlogaction ); -cronlogaction(); +my $command_line_options = join(" ",@ARGV); +cronlogaction({ info => $command_line_options }); + +Koha::Checkouts->automatic_checkin; + +cronlogaction({ action => 'End', info => "COMPLETED" }); -Koha::Checkouts->automatic_checkin; \ No newline at end of file diff --git a/misc/cronjobs/automatic_item_modification_by_age.pl b/misc/cronjobs/automatic_item_modification_by_age.pl index a4e5538430..1b1ba86be6 100755 --- a/misc/cronjobs/automatic_item_modification_by_age.pl +++ b/misc/cronjobs/automatic_item_modification_by_age.pl @@ -11,6 +11,8 @@ use C4::Context; use C4::Items; use C4::Log qw( cronlogaction ); +my $command_line_options = join(" ",@ARGV); + # Getting options my ( $verbose, $help, $confirm ); my $result = GetOptions( @@ -28,7 +30,7 @@ my $rules = eval { JSON::from_json( $syspref_content ) }; pod2usage({ -message => "Unable to load the configuration : $@", -exitval => 1 }) if $@; -cronlogaction(); +cronlogaction({ info => $command_line_options }); my $report = C4::Items::ToggleNewStatus( { rules => $rules, report_only => not $confirm } ); @@ -49,6 +51,8 @@ if ( $verbose ) { } } +cronlogaction({ action => 'End', info => "COMPLETED" }); + exit(0); __END__ diff --git a/misc/cronjobs/automatic_renewals.pl b/misc/cronjobs/automatic_renewals.pl index 0749ed5c0d..4884eee2f3 100755 --- a/misc/cronjobs/automatic_renewals.pl +++ b/misc/cronjobs/automatic_renewals.pl @@ -87,6 +87,8 @@ use Koha::Checkouts; use Koha::Libraries; use Koha::Patrons; +my $command_line_options = join(" ",@ARGV); + my ( $help, $send_notices, $verbose, $confirm, $digest_per_branch ); GetOptions( 'h|help' => \$help, @@ -127,7 +129,7 @@ To change this, edit the "EnhancedMessagingPreferences" syspref. END_WARN } -cronlogaction(); +cronlogaction({ info => $command_line_options }); $verbose = 1 unless $verbose or $confirm; print "Test run only\n" unless $confirm; @@ -285,6 +287,8 @@ if ( $send_notices && $confirm ) { } } +cronlogaction({ action => 'End', info => "COMPLETED" }); + =head1 METHODS =head2 send_digests diff --git a/misc/cronjobs/batch_anonymise.pl b/misc/cronjobs/batch_anonymise.pl index 24edb727f4..076ef83a89 100755 --- a/misc/cronjobs/batch_anonymise.pl +++ b/misc/cronjobs/batch_anonymise.pl @@ -43,6 +43,8 @@ USAGE exit $_[0]; } +my $command_line_options = join(" ",@ARGV); + my ( $help, $days, $verbose ); GetOptions( @@ -60,7 +62,7 @@ if ( !$days ) { usage(1); } -cronlogaction(); +cronlogaction({ info => $command_line_options }); my $date = dt_from_string->subtract( days => $days ); @@ -81,4 +83,6 @@ $rows = Koha::Old::Holds $verbose and print int($rows) . " holds anonymised.\n"; +cronlogaction({ action => 'End', info => "COMPLETED" }); + exit(0); diff --git a/misc/cronjobs/build_browser_and_cloud.pl b/misc/cronjobs/build_browser_and_cloud.pl index c8b12611fb..9ac409615e 100755 --- a/misc/cronjobs/build_browser_and_cloud.pl +++ b/misc/cronjobs/build_browser_and_cloud.pl @@ -15,6 +15,8 @@ use Getopt::Long; use C4::Log; use Koha::Biblios; +my $command_line_options = join(" ",@ARGV); + my ( $input_marc_file, $number) = ('',0); my ($version, $confirm,$field,$batch,$max_digits,$cloud_tag); GetOptions( @@ -57,7 +59,7 @@ my $browser_subfield = $2; warn "browser : $browser_tag / $browser_subfield" unless $batch; die "no cloud or browser field/subfield defined : nothing to do !" unless $browser_tag or $cloud_tag; -cronlogaction(); +cronlogaction({ info => $command_line_options }); my $dbh = C4::Context->dbh; @@ -165,6 +167,7 @@ if ($cloud_tag) { my $timeneeded = time() - $starttime; print "$i records done in $timeneeded seconds\n" unless $batch; +cronlogaction({ action => 'End', info => "COMPLETED" }); sub dewey_french { return { diff --git a/misc/cronjobs/cart_to_shelf.pl b/misc/cronjobs/cart_to_shelf.pl index 3c7d12e22b..96b965d89a 100755 --- a/misc/cronjobs/cart_to_shelf.pl +++ b/misc/cronjobs/cart_to_shelf.pl @@ -37,6 +37,8 @@ use Getopt::Long qw( GetOptions ); my $hours = 0; +my $command_line_options = join(" ",@ARGV); + GetOptions( 'h|hours=s' => \$hours, ); my $usage = << 'ENDUSAGE'; @@ -58,7 +60,7 @@ unless ($hours) { die "ERROR: No --hours (-h) option defined"; } -cronlogaction(); +cronlogaction({ info => $command_line_options }); my $query = "SELECT itemnumber FROM items WHERE location = 'CART' AND TIMESTAMPDIFF(HOUR, items.timestamp, NOW() ) > ?"; my $sth = C4::Context->dbh->prepare($query); @@ -66,3 +68,5 @@ $sth->execute($hours); while (my ($itemnumber) = $sth->fetchrow_array) { CartToShelf($itemnumber); } + +cronlogaction({ action => 'End', info => "COMPLETED" }); diff --git a/misc/cronjobs/cleanup_database.pl b/misc/cronjobs/cleanup_database.pl index 74505cf067..96248b7b52 100755 --- a/misc/cronjobs/cleanup_database.pl +++ b/misc/cronjobs/cleanup_database.pl @@ -149,6 +149,8 @@ my $cards; my @log_modules; my @preserve_logs; +my $command_line_options = join(" ",@ARGV); + GetOptions( 'h|help' => \$help, 'confirm' => \$confirm, @@ -249,7 +251,7 @@ if ($pDebarments && $allDebarments) { say "Confirm flag not passed, running in dry-run mode..." unless $confirm; -cronlogaction() unless $confirm; +cronlogaction({ info => $command_line_options }); my $dbh = C4::Context->dbh(); my $sth; @@ -673,6 +675,8 @@ if ($cards) { } } +cronlogaction({ action => 'End', info => "COMPLETED" }); + exit(0); sub RemoveOldSessions { diff --git a/misc/cronjobs/cloud-kw.pl b/misc/cronjobs/cloud-kw.pl index d6e64be902..08c37c4535 100755 --- a/misc/cronjobs/cloud-kw.pl +++ b/misc/cronjobs/cloud-kw.pl @@ -33,6 +33,9 @@ use C4::Log qw( cronlogaction ); my $verbose = 0; my $help = 0; my $conf = ''; + +my $command_line_options = join(" ",@ARGV); + GetOptions( 'verbose' => \$verbose, 'help' => \$help, @@ -46,7 +49,7 @@ sub usage { usage() if $help || !$conf; -cronlogaction(); +cronlogaction({ info => $command_line_options }); my @clouds; print "Reading configuration file: $conf\n" if $verbose; @@ -90,6 +93,7 @@ for my $cloud ( @clouds ) { $set_new_context && restore_context C4::Context; } +cronlogaction({ action => 'End', info => "COMPLETED" }); package ZebraIndex; diff --git a/misc/cronjobs/delete_patrons.pl b/misc/cronjobs/delete_patrons.pl index 37a1529975..9c8b87ea5b 100755 --- a/misc/cronjobs/delete_patrons.pl +++ b/misc/cronjobs/delete_patrons.pl @@ -14,6 +14,8 @@ use C4::Log qw( cronlogaction ); my ( $help, $verbose, $not_borrowed_since, $expired_before, $last_seen, @category_code, $branchcode, $file, $confirm ); +my $command_line_options = join(" ",@ARGV); + GetOptions( 'h|help' => \$help, 'v|verbose' => \$verbose, @@ -44,7 +46,7 @@ unless ( $not_borrowed_since or $expired_before or $last_seen or @category_code pod2usage(q{At least one filter is mandatory}); } -cronlogaction(); +cronlogaction({ info => $command_line_options }); my @file_members; if ($file) { @@ -139,6 +141,8 @@ for my $member (@$members) { say $confirm ? "$deleted patrons deleted" : "$deleted patrons would have been deleted" if $verbose; +cronlogaction({ action => 'End', info => "COMPLETED" }); + =head1 NAME delete_patrons - This script deletes patrons diff --git a/misc/cronjobs/fines.pl b/misc/cronjobs/fines.pl index e919d42a66..dab688b780 100755 --- a/misc/cronjobs/fines.pl +++ b/misc/cronjobs/fines.pl @@ -49,6 +49,8 @@ my $output_dir; my $log; my $maxdays; +my $command_line_options = join(" ",@ARGV); + GetOptions( 'h|help' => \$help, 'v|verbose' => \$verbose, @@ -90,7 +92,7 @@ catch { exit; }; -cronlogaction(); +cronlogaction({ info => $command_line_options }); my @borrower_fields = qw(cardnumber categorycode surname firstname email phone address citystate); @@ -200,6 +202,8 @@ Number of Overdue Items: EOM } +cronlogaction({ action => 'End', info => "COMPLETED" }); + sub set_holiday { my ( $branch, $dt ) = @_; diff --git a/misc/cronjobs/gather_print_notices.pl b/misc/cronjobs/gather_print_notices.pl index 729c0d956b..7da2e888c9 100755 --- a/misc/cronjobs/gather_print_notices.pl +++ b/misc/cronjobs/gather_print_notices.pl @@ -29,6 +29,8 @@ my ( @emails, ); +my $command_line_options = join(" ",@ARGV); + $send = 1; GetOptions( 'h|help' => \$help, @@ -72,7 +74,7 @@ if ( $ods and @letter_codes != 1 ) { $delimiter ||= q|,|; -cronlogaction(); +cronlogaction({ info => $command_line_options }); my $today_iso = output_pref( { dt => dt_from_string, dateonly => 1, dateformat => 'iso' } ) ; my $today_syspref = output_pref( { dt => dt_from_string, dateonly => 1 } ); @@ -142,6 +144,8 @@ if ( @emails ) { } } +cronlogaction({ action => 'End', info => "COMPLETED" }); + sub print_notices { my ( $params ) = @_; diff --git a/misc/cronjobs/holds/auto_unsuspend_holds.pl b/misc/cronjobs/holds/auto_unsuspend_holds.pl index 9db2b626fa..a730198682 100755 --- a/misc/cronjobs/holds/auto_unsuspend_holds.pl +++ b/misc/cronjobs/holds/auto_unsuspend_holds.pl @@ -26,6 +26,9 @@ use Koha::Script -cron; use C4::Reserves qw(AutoUnsuspendReserves); use C4::Log qw( cronlogaction ); -cronlogaction(); +my $command_line_options = join(" ",@ARGV); +cronlogaction({ info => $command_line_options }); AutoUnsuspendReserves(); + +cronlogaction({ action => 'End', info => "COMPLETED" }); diff --git a/misc/cronjobs/holds/build_holds_queue.pl b/misc/cronjobs/holds/build_holds_queue.pl index 6ba476b585..f0bd66eaf4 100755 --- a/misc/cronjobs/holds/build_holds_queue.pl +++ b/misc/cronjobs/holds/build_holds_queue.pl @@ -13,7 +13,9 @@ use Koha::Script -cron; use C4::HoldsQueue qw(CreateQueue); use C4::Log qw( cronlogaction ); -cronlogaction(); +my $command_line_options = join(" ",@ARGV); +cronlogaction({ info => $command_line_options }); CreateQueue(); +cronlogaction({ action => 'End', info => "COMPLETED" }); diff --git a/misc/cronjobs/holds/cancel_expired_holds.pl b/misc/cronjobs/holds/cancel_expired_holds.pl index a4addc0170..5d7de4cbee 100755 --- a/misc/cronjobs/holds/cancel_expired_holds.pl +++ b/misc/cronjobs/holds/cancel_expired_holds.pl @@ -65,12 +65,16 @@ Optionally adds a reason for cancellation (which will trigger a notice to be sen my $help = 0; my $reason; +my $command_line_options = join(" ",@ARGV); + GetOptions( 'help|?' => \$help, 'reason=s' => \$reason ) or pod2usage(1); pod2usage(1) if $help; -cronlogaction(); +cronlogaction({ info => $command_line_options }); C4::Reserves::CancelExpiredReserves($reason); + +cronlogaction({ action => 'End', info => "COMPLETED" }); diff --git a/misc/cronjobs/holds/cancel_unfilled_holds.pl b/misc/cronjobs/holds/cancel_unfilled_holds.pl index ea5d70ab48..82e2b18516 100755 --- a/misc/cronjobs/holds/cancel_unfilled_holds.pl +++ b/misc/cronjobs/holds/cancel_unfilled_holds.pl @@ -80,6 +80,8 @@ my $use_calendar = 0; my $verbose = 0; my $confirm = 0; +my $command_line_options = join(" ",@ARGV); + GetOptions( 'h|help|?' => \$help, 'days=s' => \$days, @@ -99,6 +101,9 @@ qq{\nError: You must specify a value for days waiting to cancel holds.\n}, } ); } + +cronlogaction({ info => $command_line_options }); + warn "Running in test mode, no actions will be taken" unless ($confirm); $verbose and warn "Looking for unfilled holds placed $days or more days ago\n"; @@ -136,3 +141,5 @@ foreach my $branch (@branchcodes) { } } + +cronlogaction({ action => 'End', info => "COMPLETED" }); diff --git a/misc/cronjobs/holds/holds_reminder.pl b/misc/cronjobs/holds/holds_reminder.pl index 96290c00ad..813eb0eb2e 100755 --- a/misc/cronjobs/holds/holds_reminder.pl +++ b/misc/cronjobs/holds/holds_reminder.pl @@ -176,6 +176,8 @@ my $date_input; my $opt_out = 0; my @mtts; +my $command_line_options = join(" ",@ARGV); + GetOptions( 'help|?' => \$help, 'man' => \$man, @@ -194,7 +196,7 @@ pod2usage( -verbose => 2 ) if $man; $lettercode ||= 'HOLD_REMINDER'; -cronlogaction(); +cronlogaction({ info => $command_line_options }); # Unless a delay is specified by the user we target all waiting holds unless (defined $days) { @@ -313,3 +315,5 @@ foreach my $branchcode (@branchcodes) { #BEGIN BRANCH LOOP } #END BRANCH LOOP + +cronlogaction({ action => 'End', info => "COMPLETED" }); diff --git a/misc/cronjobs/longoverdue.pl b/misc/cronjobs/longoverdue.pl index 457ddf4465..2d313b77b2 100755 --- a/misc/cronjobs/longoverdue.pl +++ b/misc/cronjobs/longoverdue.pl @@ -53,6 +53,8 @@ my $list_categories = 0; my $list_itemtypes = 0; my @skip_lost_values; +my $command_line_options = join(" ",@ARGV); + GetOptions( 'l|lost=s%' => \$lost, 'c|charge=s' => \$charge, @@ -278,7 +280,7 @@ unless ($confirm) { print "### TEST MODE -- NO ACTIONS TAKEN ###\n"; } -cronlogaction(); +cronlogaction({ info => $command_line_options }); # In my opinion, this line is safe SQL to have outside the API. --atz our $bounds_sth = C4::Context->dbh->prepare("SELECT DATE_SUB(CURDATE(), INTERVAL ? DAY)"); @@ -443,3 +445,5 @@ if (!$quiet){ summarize (\@report, 1); print "\nTOTAL: $total items\n"; } + +cronlogaction({ action => 'End', info => "COMPLETED" }); diff --git a/misc/cronjobs/membership_expiry.pl b/misc/cronjobs/membership_expiry.pl index c52843c7dc..18c40be18f 100755 --- a/misc/cronjobs/membership_expiry.pl +++ b/misc/cronjobs/membership_expiry.pl @@ -158,6 +158,8 @@ my $after = 0; my ( $branch, $letter_type ); my @where; +my $command_line_options = join(" ",@ARGV); + GetOptions( 'help|?' => \$help, 'man' => \$man, @@ -174,7 +176,7 @@ GetOptions( pod2usage( -verbose => 2 ) if $man; pod2usage(1) if $help || !$confirm; -cronlogaction(); +cronlogaction({ info => $command_line_options }); my $expdays = C4::Context->preference('MembershipExpiryDaysNotice'); if( !$expdays ) { @@ -225,3 +227,5 @@ while ( my $recent = $upcoming_mem_expires->next ) { }); } } + +cronlogaction({ action => 'End', info => "COMPLETED" }); diff --git a/misc/cronjobs/overdue_notices.pl b/misc/cronjobs/overdue_notices.pl index 642c83fffa..3eca0337df 100755 --- a/misc/cronjobs/overdue_notices.pl +++ b/misc/cronjobs/overdue_notices.pl @@ -309,6 +309,8 @@ my @myborcat; my @myborcatout; my ( $date_input, $today ); +my $command_line_options = join(" ",@ARGV); + GetOptions( 'help|?' => \$help, 'man' => \$man, @@ -331,7 +333,7 @@ GetOptions( ) or pod2usage(2); pod2usage(1) if $help; pod2usage( -verbose => 2 ) if $man; -cronlogaction() unless $test_mode; +cronlogaction({ info => $command_line_options }); if ( defined $csvfilename && $csvfilename =~ /^-/ ) { warn qq(using "$csvfilename" as filename, that seems odd); @@ -937,3 +939,4 @@ sub prepare_letter_for_printing { return $return; } +cronlogaction({ action => 'End', info => "COMPLETED" }); diff --git a/misc/cronjobs/patron_emailer.pl b/misc/cronjobs/patron_emailer.pl index 443d846473..1fcc93ccd7 100755 --- a/misc/cronjobs/patron_emailer.pl +++ b/misc/cronjobs/patron_emailer.pl @@ -25,8 +25,6 @@ use Pod::Usage qw( pod2usage ); use C4::Log qw( cronlogaction ); use C4::Reports::Guided qw( EmailReport ); -cronlogaction(); - =head1 NAME patron_emailer.pl @@ -119,6 +117,8 @@ my $error_msgs = { NO_BOR => "There is no borrower with borrowernumber " }; +my $command_line_options = join(" ",@ARGV); + GetOptions( 'help|?' => \$help, 'report=i' => \$report_id, @@ -133,6 +133,8 @@ GetOptions( pod2usage(1) if $help; pod2usage(1) unless $report_id && $notice && $module; +cronlogaction({ info => $command_line_options }); + my ( $emails, $errors ) = C4::Reports::Guided::EmailReport({ email => $email, from => $from, @@ -169,3 +171,5 @@ if( $verbose || !$commit ){ } } } + +cronlogaction({ action => 'End', info => "COMPLETED" }); diff --git a/misc/cronjobs/plugins_nightly.pl b/misc/cronjobs/plugins_nightly.pl index a90423e749..218ed13fc0 100755 --- a/misc/cronjobs/plugins_nightly.pl +++ b/misc/cronjobs/plugins_nightly.pl @@ -10,7 +10,8 @@ use Koha::Logger; use Koha::Plugins; use Koha::Script -cron; -cronlogaction(); +my $command_line_options = join(" ",@ARGV); +cronlogaction({ info => $command_line_options }); my $logger = Koha::Logger->get(); if ( C4::Context->config("enable_plugins") ) { @@ -31,6 +32,8 @@ if ( C4::Context->config("enable_plugins") ) { } } +cronlogaction({ action => 'End', info => "COMPLETED" }); + =head1 NAME plugins_nightly.pl - Run nightly tasks specified by plugins diff --git a/misc/cronjobs/process_message_queue.pl b/misc/cronjobs/process_message_queue.pl index b67b8530ad..5abeb80342 100755 --- a/misc/cronjobs/process_message_queue.pl +++ b/misc/cronjobs/process_message_queue.pl @@ -35,6 +35,8 @@ my $verbose = 0; my $type = q{}; my $letter_code; +my $command_line_options = join(" ",@ARGV); + GetOptions( 'u|username:s' => \$username, 'p|password:s' => \$password, @@ -79,7 +81,7 @@ catch { exit; }; -cronlogaction(); +cronlogaction({ info => $command_line_options }); if ( C4::Context->config("enable_plugins") ) { my @plugins = Koha::Plugins->new->GetPlugins({ @@ -117,3 +119,4 @@ C4::Letters::SendQueuedMessages( } ); +cronlogaction({ action => 'End', info => "COMPLETED" }); diff --git a/misc/cronjobs/purge_suggestions.pl b/misc/cronjobs/purge_suggestions.pl index 7b55efb1aa..f4fba6e083 100755 --- a/misc/cronjobs/purge_suggestions.pl +++ b/misc/cronjobs/purge_suggestions.pl @@ -28,6 +28,8 @@ use C4::Context; my ( $help, $days, $confirm ); +my $command_line_options = join(" ",@ARGV); + GetOptions( 'help|?' => \$help, 'days:i' => \$days, @@ -57,8 +59,11 @@ if( !$confirm || $help || !defined($days) ) { print "No confirm parameter passed!\n\n" if !$confirm && !$help; print $usage; } elsif( $days and $days > 0 ) { - cronlogaction( " ( days: $days )"); + $command_line_options .= " ( effective days = $days )"; + cronlogaction({ info => $command_line_options }); DelSuggestionsOlderThan($days); } else { warn "This script requires a positive number of days. Aborted.\n"; } + +cronlogaction({ action => 'End', info => "COMPLETED" }); diff --git a/misc/cronjobs/recalls/expire_recalls.pl b/misc/cronjobs/recalls/expire_recalls.pl index 7a4a6deebf..7e57398614 100755 --- a/misc/cronjobs/recalls/expire_recalls.pl +++ b/misc/cronjobs/recalls/expire_recalls.pl @@ -35,7 +35,9 @@ use Koha::DateUtils qw( dt_from_string ); use Koha::Recalls; use C4::Log; -cronlogaction(); +my $command_line_options = join(" ",@ARGV); + +cronlogaction({ info => $command_line_options }); my $recalls = Koha::Recalls->search({ completed => 0 }); while( my $recall = $recalls->next ) { @@ -66,3 +68,5 @@ while( my $recall = $recalls->next ) { } } } + +cronlogaction({ action => 'End', info => "COMPLETED" }); diff --git a/misc/cronjobs/recalls/overdue_recalls.pl b/misc/cronjobs/recalls/overdue_recalls.pl index d0e60859b4..81b4070383 100755 --- a/misc/cronjobs/recalls/overdue_recalls.pl +++ b/misc/cronjobs/recalls/overdue_recalls.pl @@ -34,7 +34,9 @@ use Koha::Checkouts; use Koha::Recalls; use C4::Log; -cronlogaction(); +my $command_line_options = join(" ",@ARGV); + +cronlogaction({ info => $command_line_options }); my $recalls = Koha::Recalls->search({ status => 'R' }); while( my $recall = $recalls->next ) { @@ -42,3 +44,5 @@ while( my $recall = $recalls->next ) { $recall->set_overdue({ interface => 'COMMANDLINE' }); } } + +cronlogaction({ action => 'End', info => "COMPLETED" }); diff --git a/misc/cronjobs/reconcile_balances.pl b/misc/cronjobs/reconcile_balances.pl index b200df1921..5d2c368979 100755 --- a/misc/cronjobs/reconcile_balances.pl +++ b/misc/cronjobs/reconcile_balances.pl @@ -64,13 +64,15 @@ use Koha::Patrons; my $help = 0; my $verbose = 0; +my $command_line_options = join(" ",@ARGV); + GetOptions( 'help' => \$help, 'verbose' => \$verbose ) or pod2usage(2); pod2usage(1) if $help; -cronlogaction(); +cronlogaction({ info => $command_line_options }); my @patron_ids = Koha::Account::Lines->search( { @@ -111,6 +113,8 @@ while (my $patron = $patrons->next) { } } +cronlogaction({ action => 'End', info => "COMPLETED" }); + 1; __END__ diff --git a/misc/cronjobs/runreport.pl b/misc/cronjobs/runreport.pl index bc3c85c5d8..d6fbb7fcbc 100755 --- a/misc/cronjobs/runreport.pl +++ b/misc/cronjobs/runreport.pl @@ -186,6 +186,8 @@ my $username = undef; my $password = undef; my $method = 'LOGIN'; +my $command_line_options = join(" ",@ARGV); + GetOptions( 'help|?' => \$help, 'man' => \$man, @@ -208,7 +210,7 @@ pod2usage( -verbose => 2 ) if ($man); pod2usage( -verbose => 2 ) if ($help and $verbose); pod2usage(1) if $help; -cronlogaction(); +cronlogaction({ info => $command_line_options }); unless ($format) { $verbose and print STDERR "No format specified, assuming 'text'\n"; @@ -359,3 +361,5 @@ foreach my $report_id (@ARGV) { print $message; } } + +cronlogaction({ action => 'End', info => "COMPLETED" }); diff --git a/misc/cronjobs/serialsUpdate.pl b/misc/cronjobs/serialsUpdate.pl index ca6cb11d5b..0b8a2acb2d 100755 --- a/misc/cronjobs/serialsUpdate.pl +++ b/misc/cronjobs/serialsUpdate.pl @@ -59,6 +59,8 @@ my $verbose = 0; my $note = ''; my $nonote = 0; +my $command_line_options = join(" ",@ARGV); + GetOptions( 'help|h|?' => \$help, 'man' => \$man, @@ -71,7 +73,7 @@ GetOptions( pod2usage(1) if $help; pod2usage( -verbose => 2 ) if $man; -cronlogaction(); +cronlogaction({ info => $command_line_options }); $verbose and !$confirm and print "### Database will not be modified ###\n"; @@ -141,3 +143,5 @@ while ( my $issue = $sth->fetchrow_hashref ) { } } } + +cronlogaction({ action => 'End', info => "COMPLETED" }); diff --git a/misc/cronjobs/share_usage_with_koha_community.pl b/misc/cronjobs/share_usage_with_koha_community.pl index fa6d59850f..671bbe1a1a 100755 --- a/misc/cronjobs/share_usage_with_koha_community.pl +++ b/misc/cronjobs/share_usage_with_koha_community.pl @@ -11,6 +11,8 @@ use C4::UsageStats; use C4::Log qw( cronlogaction ); use POSIX qw( strftime ); +my $command_line_options = join(" ",@ARGV); + my ( $help, $verbose, $force, $quiet ); GetOptions( 'h|help' => \$help, @@ -36,7 +38,7 @@ Setting the quiet flag will silence this message. exit 1; } -cronlogaction(); +cronlogaction({ info => $command_line_options }); my $need_update = ($force ? 1 : C4::UsageStats::NeedUpdate() ); @@ -51,6 +53,8 @@ elsif ($verbose) { say "Data don't need to be updated"; } +cronlogaction({ action => 'End', info => "COMPLETED" }); + =head1 NAME share_usage_with_koha_community.pl - Share your library's usage with the Koha community diff --git a/misc/cronjobs/staticfines.pl b/misc/cronjobs/staticfines.pl index 36d5fb20b2..53b9e4bf5b 100755 --- a/misc/cronjobs/staticfines.pl +++ b/misc/cronjobs/staticfines.pl @@ -52,6 +52,8 @@ my $borrowersalreadyapplied; # hashref of borrowers for whom we already applied my $debug = 0; my $bigdebug = 0; +my $command_line_options = join(" ",@ARGV); + GetOptions( 'h|help' => \$help, 'v|verbose' => \$verbose, @@ -81,7 +83,7 @@ This script has the following parameters : ENDUSAGE die $usage if $help; -cronlogaction(); +cronlogaction({ info => $command_line_options }); my $dbh = C4::Context->dbh; @@ -238,3 +240,4 @@ Number of Overdue Items: EOM } +cronlogaction({ action => 'End', info => "COMPLETED" }); diff --git a/misc/cronjobs/update_totalissues.pl b/misc/cronjobs/update_totalissues.pl index a3f561bbf5..eee8fdef62 100755 --- a/misc/cronjobs/update_totalissues.pl +++ b/misc/cronjobs/update_totalissues.pl @@ -52,6 +52,8 @@ my $incremental = 0; my $commit = 100; my $unit; +my $command_line_options = join(" ",@ARGV); + my $result = GetOptions( 'v|verbose' => \$verbose, 't|test' => \$test_only, @@ -90,7 +92,7 @@ if ( not $result or $want_help ) { usage(); } -cronlogaction(); +cronlogaction({ info => $command_line_options }); my $dbh = C4::Context->dbh; $dbh->{AutoCommit} = 0; @@ -105,6 +107,8 @@ process_stats() if $usestats; report(); +cronlogaction({ action => 'End', info => "COMPLETED" }); + exit 0; sub process_items { -- 2.39.5