diff --git a/Koha/Script.pm b/Koha/Script.pm index 0d46156d53..347824d61f 100644 --- a/Koha/Script.pm +++ b/Koha/Script.pm @@ -39,9 +39,28 @@ use File::Basename qw( fileparse ); use Fcntl qw( LOCK_EX LOCK_NB ); use C4::Context; +use C4::Log qw( cronlogaction ); use Koha::Exceptions; use Koha::Exception; +INIT { + my $command_line_options = join( " ", @ARGV ); + cronlogaction( { info => $command_line_options } ); +} + +END { + cronlogaction( { action => 'End', info => "COMPLETED" } ); +} + +=head2 import + + use Koha::Script; + use Koha::Script -cron; + +Sets the interface and userenv appropriately based on the flags passed. + +=cut + sub import { my $class = shift; my @flags = @_; diff --git a/misc/cronjobs/fines.pl b/misc/cronjobs/fines.pl index 4765eff3cd..e3232f24dd 100755 --- a/misc/cronjobs/fines.pl +++ b/misc/cronjobs/fines.pl @@ -50,8 +50,6 @@ my $log; my $maxdays; my $verify_issue; -my $command_line_options = join( " ", @ARGV ); -cronlogaction( { info => $command_line_options } ); GetOptions( 'h|help' => \$help, @@ -212,8 +210,6 @@ Number of Overdue Items: EOM } -cronlogaction( { action => 'End', info => "COMPLETED" } ); - sub set_holiday { my ( $branch, $dt ) = @_; diff --git a/misc/link_bibs_to_authorities.pl b/misc/link_bibs_to_authorities.pl index c9d5aa308c..89f2e02e50 100755 --- a/misc/link_bibs_to_authorities.pl +++ b/misc/link_bibs_to_authorities.pl @@ -72,8 +72,6 @@ if ( not $result or $want_help ) { usage(); } -cronlogaction( { info => $command_line_options } ); - my $linker_module = "C4::Linker::" . ( C4::Context->preference("LinkerModule") || 'Default' ); unless ( can_load( modules => { $linker_module => undef } ) ) { $linker_module = 'C4::Linker::Default';