2 # ---------------------------------------------------------------------
3 # Fine generator with default grace period param.
4 # ./object_dumper.pl <bootstrap_config> <lockfile> <grace (default 0)>
5 # ---------------------------------------------------------------------
9 use OpenSRF::Utils::JSON;
12 my $config = shift || die "bootstrap config required\n";
13 my $lockfile = shift || "/tmp/generate_fines-LOCK";
16 $grace = '' if (!defined($grace) or $grace == 0);
23 open(F,'/bin/ps axo pid|');
24 while ( my $p = <F>) {
26 if ($p =~ s/\s*(\d+)$/$1/o && $p == $pid) {
27 die "I seem to be running already at pid $pid. If not, try again\n";
33 open(F, ">$lockfile");
37 OpenSRF::System->bootstrap_client( config_file => $config );
39 my $r = OpenSRF::AppSession
40 ->create( 'open-ils.storage' )
41 ->request( 'open-ils.storage.action.circulation.overdue.generate_fines' => $grace );
43 while (!$r->complete) { $r->recv };