]> git.evergreen-ils.org Git - working/Evergreen.git/blob - Open-ILS/src/support-scripts/make-mods.pl
lp1777675 inventory date support
[working/Evergreen.git] / Open-ILS / src / support-scripts / make-mods.pl
1 #!/usr/bin/perl
2 require 'oils_header.pl';
3 use strict; use warnings;
4 use OpenSRF::EX qw(:try);
5
6 # ------------------------------------------------------------
7 # Forks workers to force mods-ization of metarecords
8 # ------------------------------------------------------------
9
10 my $config      = shift; 
11 my $minid       = shift;
12 my $maxid       = shift;
13 my $workers     = shift || 1;
14 my $id          = 0;
15
16 die "$0 <config> <minid> <maxid> [<num_processes>]\n" unless $maxid;
17
18 die "too many workers..\n" if $workers > 20;
19
20 for(1..$workers) {
21         last if fork();
22         $id = $_;
23 }
24
25 osrf_connect($config);
26
27 for( $minid..$maxid ) {
28
29         next unless $_ % $workers == $id;
30
31         try {
32
33                 my $val = simplereq( 
34                         'open-ils.search', 
35                         'open-ils.search.biblio.metarecord.mods_slim.retrieve', 
36                         $_ );
37
38                 if( oils_is_event($val) ) {
39                         print "$_ - not found\n";
40                 } else {
41                         print "$_\n";
42                 }
43
44         } catch Error with {
45                 print "$_ failed\n";
46         };
47 }
48