Bug 41851: Add logging to edi cron job
To test:
1 - Enable cronjob logging:
http://localhost:8081/cgi-bin/koha/admin/preferences.pl?op=search&searchfield=CronjobLog
2 - Enable EDIFACT
http://localhost:8081/cgi-bin/koha/admin/preferences.pl?op=search&searchfield=EDIFACT
3 - perl misc/cronjobs/edi_cron.pl
4 - Check action logs for cronjobs:
http://localhost:8081/cgi-bin/koha/tools/viewlog.pl?src=&user=&modules=CRONJOBS&actions=&object=&info=&interfaces=&from=&to=&output=screen&basename=Export&report_name=&do_it=1
5 - No log
6 - Apply patch
7 - perl misc/cronjobs/edi_cron.pl
8 - Refresh the action logs screen
9 - Success! Start and end logged
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Emily Lamancusa <emily.lamancusa@montgomerycountymd.gov>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
This commit is contained in:
parent
22fa60828f
commit
18ffe25210
|
|
@ -36,10 +36,14 @@ use Koha::EDI qw( process_quote process_invoice process_ordrsp );
|
|||
use Koha::Edifact::Transport;
|
||||
use Koha::Logger;
|
||||
use Koha::Plugins::Handler;
|
||||
use Fcntl qw( LOCK_EX O_CREAT O_RDWR SEEK_SET );
|
||||
use Fcntl qw( LOCK_EX O_CREAT O_RDWR SEEK_SET );
|
||||
use C4::Log qw( cronlogaction );
|
||||
|
||||
die "Syspref 'EDIFACT' is disabled" unless C4::Context->preference('EDIFACT');
|
||||
|
||||
my $command_line_options = join( " ", @ARGV );
|
||||
cronlogaction( { info => $command_line_options } );
|
||||
|
||||
# we dont have a lock dir in context so use the logdir
|
||||
my $logdir = C4::Context->config('logdir');
|
||||
my $pidfile = "$logdir/edicron.pid";
|
||||
|
|
@ -150,6 +154,8 @@ if ( close $pid_handle ) {
|
|||
exit 1;
|
||||
}
|
||||
|
||||
cronlogaction( { action => 'End', info => "COMPLETED" } );
|
||||
|
||||
sub check_pidfile {
|
||||
|
||||
# sysopen my $fh, $pidfile, O_EXCL | O_RDWR or log_exit "$0 already running"
|
||||
|
|
|
|||
Loading…
Reference in New Issue