From 71d0775cc701e741ef940f120921627a7f7b451c Mon Sep 17 00:00:00 2001 From: Martin Renvoize Date: Thu, 13 Feb 2020 10:46:22 +0000 Subject: [PATCH] Bug 24651: Add maxdays option to fines cronjob This patch adds an optional maxdays parameter to the fines.pl cronjob. The new parameter allows system administrators to set a maximum number of days for the job to process overdues. This can improve performance. Signed-off-by: Sally Healey Signed-off-by: Kyle M Hall Signed-off-by: Martin Renvoize --- misc/cronjobs/fines.pl | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/misc/cronjobs/fines.pl b/misc/cronjobs/fines.pl index f04da4b280..df85affd8d 100755 --- a/misc/cronjobs/fines.pl +++ b/misc/cronjobs/fines.pl @@ -45,12 +45,14 @@ my $help; my $verbose; my $output_dir; my $log; +my $maxdays; GetOptions( 'h|help' => \$help, 'v|verbose' => \$verbose, 'l|log' => \$log, 'o|out:s' => \$output_dir, + 'm|maxdays:i' => \$maxdays, ); my $usage = << 'ENDUSAGE'; @@ -64,6 +66,7 @@ This script has the following parameters : -l --log: log the output to a file (optional if the -o parameter is given) -o --out: ouput directory for logs (defaults to env or /tmp if !exist) -v --verbose + -m --maxdays: how many days back of overdues to process ENDUSAGE @@ -97,7 +100,9 @@ if ($filename) { print {$fh} "\n"; } my $counted = 0; -my $overdues = Getoverdues(); +my $params; +$params->{maximumdays} = $maxdays if $maxdays; +my $overdues = Getoverdues($params); for my $overdue ( @{$overdues} ) { next if $overdue->{itemlost}; -- 2.39.5