@@ -, +, @@ a normal exit happens, so we don't flood the logs in vain. --verbose will make the script print the same message on STDERR, as already is the case with this script $ kshell k$ perl misc/cronjobs/fines.pl --verbose and prints a message about the lock. --- misc/cronjobs/fines.pl | 14 ++++++++++++++ 1 file changed, 14 insertions(+) --- a/misc/cronjobs/fines.pl +++ a/misc/cronjobs/fines.pl @@ -36,6 +36,7 @@ use C4::Overdues; use Getopt::Long; use Carp; use File::Spec; +use Try::Tiny; use Koha::Calendar; use Koha::DateUtils; @@ -76,6 +77,19 @@ if ($help) { exit; } +my $script_handler = Koha::Script->new({ script => $0 }); + +try { + $script_handler->lock_exec; +} +catch { + my $message = "Skipping execution of $0 ($_)"; + print STDERR $message + if $verbose; + cronlogaction( $message ); + exit; +}; + cronlogaction(); my @borrower_fields = --