Hi
I looked around for a script that would return the number of jobs on a queue for each location, but I couldn’t find one.
So I just wrote up this quick script that others may find useful.
[php]
<?php /** Returns the number of jobs in the queue for each location */ chdir('..'); include 'common.inc'; $locations = parse_ini_file('./settings/locations.ini', true); BuildLocations($locations); header ('Content-type: text/xml'); echo "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n";echo “\n”;
echo “200\n”;
echo “Ok\n”;
echo “\n”;
$processed = array();
foreach ($locations as $key => $loc) {
//no local directory? Then there’s nothing to query
if (!isset($loc[‘localDir’])) continue;
if (($pos = strpos($key, ‘:’)) !== false) {
$key = substr($key, 0 , $pos);
}
if (isset($processed[$key])) continue;
$processed[$key] = true;
$jobs = count(scandir($loc['localDir'])) - 2; //subtract directories from final count
echo "<location>\n";
echo "<id>$key</id>";
echo "<jobs>$jobs</jobs>";
echo "</location>\n";
}
echo “\n”;
echo “\n”;
[/php]
It needs to be placed in the work directory