2 # ---------------------------------------------------------------------
3 # Long Overdue script with default period param.
4 # ./long-overdue-status-update.pl <bootstrap_config> <lockfile> <age (default '180 days')>
5 # ---------------------------------------------------------------------
9 use OpenSRF::Utils::JSON;
12 my $config = shift || die "bootstrap config required\n";
13 my $lockfile = shift || "/tmp/long_overdue-LOCK";
16 $age = '180 days' if (!defined($age));
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.long_overdue' => $age );
43 while (!$r->complete) { $r->recv };