@@ -, +, @@ of stdout. --- misc/cronjobs/check-url.pl | 32 ++++++++++++++++++-------------- 1 file changed, 18 insertions(+), 14 deletions(-) --- a/misc/cronjobs/check-url.pl +++ a/misc/cronjobs/check-url.pl @@ -155,20 +155,20 @@ my $verbose = 0; my $help = 0; my $host = ''; my $host_pro = ''; -my $html = 0; +my $html = ''; my $uriedit = "/cgi-bin/koha/cataloguing/addbiblio.pl?biblionumber="; my $agent = ''; my $timeout = 15; GetOptions( 'verbose' => \$verbose, - 'html' => \$html, + 'html:s' => \$html, 'help' => \$help, 'host=s' => \$host, 'host-pro=s' => \$host_pro, 'agent=s' => \$agent, 'timeout=i', => \$timeout, ); - +my $htmlfh; sub usage { pod2usage( -verbose => 2 ); @@ -195,8 +195,8 @@ sub check_all_url { my $sth = $dbh->prepare( "SELECT biblionumber FROM biblioitems WHERE url <> ''" ); $sth->execute; - if ( $html ) { - print < @@ -207,16 +207,17 @@ EOS next unless $result; # No URL foreach my $url ( @$result ) { if ( ! $url->{ is_success } || $verbose ) { - print $html - ? "\n\n\n\n\n\n" - : "$biblionumber\t" . $url->{ url } . "\t" . - $url->{ status } . "\n"; + if($htmlfh){ + my $message = "\n\n\n\n\n\n"; + print $htmlfh $message; + } + print "$biblionumber\t$url->{ url }\t$url->{ status }\n" if (!$htmlfh || $verbose); } } } - print "
" . bibediturl( $biblionumber ) . - "" . $url->{url} . "" . - $url->{status} . "
" . bibediturl( $biblionumber ) . + "" . $url->{url} . "" . + $url->{status} . "
\n\n\n" if $html; + print $htmlfh "\n\n\n" if $htmlfh; } @@ -233,8 +234,11 @@ if ( $html && !$host_pro ) { exit; } } - -check_all_url(); +if($html){ + open($htmlfh, '>', $html) or die $!; +} +check_all_url(); +close $htmlfh if $htmlfh; --