Example #1
0
<?php

date_default_timezone_set('America/Detroit');
$locum_lib_dir = '/usr/local/lib/locum';
// Include Locum libraries
require_once $locum_lib_dir . '/locum-client.php';
$locum = new locum_client();
// Rebuild timestamp queue if needed
if ($argv[1] == 'rebuild') {
    echo "Rebuilding timestamps queue...\n";
    $count = $locum->rebuild_status_timestamps();
    echo "Added {$count} records to the timestamp queue\n";
} else {
    if ($argv[1] == 'todays_bibs') {
        // Work from the todays_bibs queue
        echo "Starting availcache worker for today's bibs\n";
        while (1) {
            if ($bnum = $locum->redis->spop('todays_bibs')) {
                $now_date = date('m-d-Y G:i:s');
                echo "[{$now_date}] UPDATING {$bnum}\n";
                $locum->get_item_status($bnum, TRUE);
            } else {
                // No bibs to be updated, sleep and look again
                sleep(10);
            }
        }
    } else {
        // Identify queue offset to work from
        $q_offset = (int) ($argv[1] ? $argv[1] * 10 : 0);
        echo "Starting availcache worker with queue offset {$q_offset}\n";
        while (1) {