added verbosity for diagnostic purposes
This commit is contained in:
parent
41d0813eae
commit
287301e0a3
1 changed files with 43 additions and 1 deletions
|
|
@ -12,26 +12,57 @@
|
||||||
our $webguiRoot;
|
our $webguiRoot;
|
||||||
|
|
||||||
BEGIN {
|
BEGIN {
|
||||||
$webguiRoot = $ARGV[0] || "..";
|
$webguiRoot = "..";
|
||||||
unshift (@INC, $webguiRoot."/lib");
|
unshift (@INC, $webguiRoot."/lib");
|
||||||
}
|
}
|
||||||
|
|
||||||
use DBI;
|
use DBI;
|
||||||
|
use Getopt::Long;
|
||||||
use strict qw(subs vars);
|
use strict qw(subs vars);
|
||||||
use WebGUI::Session;
|
use WebGUI::Session;
|
||||||
use WebGUI::Utility;
|
use WebGUI::Utility;
|
||||||
|
|
||||||
|
$|=1;
|
||||||
|
|
||||||
|
my $verbose;
|
||||||
|
my $help;
|
||||||
|
|
||||||
|
GetOptions(
|
||||||
|
'help'=>\$help,
|
||||||
|
'verbose'=>\$verbose
|
||||||
|
);
|
||||||
|
|
||||||
|
if ($help) {
|
||||||
|
print <<STOP;
|
||||||
|
|
||||||
|
|
||||||
|
Usage: perl $0
|
||||||
|
|
||||||
|
Options:
|
||||||
|
|
||||||
|
--help Displays this message.
|
||||||
|
|
||||||
|
--verbose Displays output describing the scheduler's
|
||||||
|
activities.
|
||||||
|
|
||||||
|
STOP
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
|
||||||
|
print "\nStarting.\n\n" if ($verbose);
|
||||||
|
|
||||||
my (@files, $cmd, $namespace, $file, $slash, $confdir, %plugins, $plugdir, $exclude);
|
my (@files, $cmd, $namespace, $file, $slash, $confdir, %plugins, $plugdir, $exclude);
|
||||||
$slash = ($^O =~ /^Win/i) ? "\\" : "/";
|
$slash = ($^O =~ /^Win/i) ? "\\" : "/";
|
||||||
$confdir = $webguiRoot.$slash."etc".$slash;
|
$confdir = $webguiRoot.$slash."etc".$slash;
|
||||||
$plugdir = $webguiRoot.$slash."sbin".$slash."Hourly".$slash;
|
$plugdir = $webguiRoot.$slash."sbin".$slash."Hourly".$slash;
|
||||||
|
|
||||||
|
print "Locating plug-ins:\n" if ($verbose);
|
||||||
if (opendir (PLUGDIR,$plugdir)) {
|
if (opendir (PLUGDIR,$plugdir)) {
|
||||||
@files = readdir(PLUGDIR);
|
@files = readdir(PLUGDIR);
|
||||||
foreach $file (@files) {
|
foreach $file (@files) {
|
||||||
if ($file =~ /(.*?)\.pm$/) {
|
if ($file =~ /(.*?)\.pm$/) {
|
||||||
$namespace = $1;
|
$namespace = $1;
|
||||||
|
print "\tFound ".$namespace."\n" if ($verbose);
|
||||||
$cmd = "use Hourly::".$namespace;
|
$cmd = "use Hourly::".$namespace;
|
||||||
eval($cmd);
|
eval($cmd);
|
||||||
$plugins{$namespace} = "Hourly::".$namespace."::process";
|
$plugins{$namespace} = "Hourly::".$namespace."::process";
|
||||||
|
|
@ -43,22 +74,32 @@ if (opendir (PLUGDIR,$plugdir)) {
|
||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if (opendir (CONFDIR,$confdir)) {
|
if (opendir (CONFDIR,$confdir)) {
|
||||||
@files = readdir(CONFDIR);
|
@files = readdir(CONFDIR);
|
||||||
foreach $file (@files) {
|
foreach $file (@files) {
|
||||||
if ($file =~ /(.*?)\.conf$/ && $file ne "some_other_site.conf") {
|
if ($file =~ /(.*?)\.conf$/ && $file ne "some_other_site.conf") {
|
||||||
|
print "\nProcessing ".$file.":\n" if ($verbose);
|
||||||
|
my $startTime = time();
|
||||||
WebGUI::Session::open($webguiRoot,$file);
|
WebGUI::Session::open($webguiRoot,$file);
|
||||||
WebGUI::Session::refreshUserInfo(3,$session{dbh});
|
WebGUI::Session::refreshUserInfo(3,$session{dbh});
|
||||||
|
my $previousTime = time();
|
||||||
|
my $currentTime;
|
||||||
foreach $namespace (keys %plugins) {
|
foreach $namespace (keys %plugins) {
|
||||||
|
$currentTime = time();
|
||||||
|
print "\t".$namespace if ($verbose);
|
||||||
$exclude = $session{config}{excludeHourly};
|
$exclude = $session{config}{excludeHourly};
|
||||||
$exclude =~ s/ //g;
|
$exclude =~ s/ //g;
|
||||||
unless (isIn($namespace, split(/,/,$exclude))) {
|
unless (isIn($namespace, split(/,/,$exclude))) {
|
||||||
$cmd = $plugins{$namespace};
|
$cmd = $plugins{$namespace};
|
||||||
&$cmd();
|
&$cmd();
|
||||||
}
|
}
|
||||||
|
print " (".($currentTime-$previousTime)." seconds)\n" if ($verbose);
|
||||||
|
$previousTime = $currentTime;
|
||||||
}
|
}
|
||||||
WebGUI::Session::end($session{var}{sessionId});
|
WebGUI::Session::end($session{var}{sessionId});
|
||||||
WebGUI::Session::close();
|
WebGUI::Session::close();
|
||||||
|
print "\tTOTAL TIME: ".(time()-$startTime)." seconds\n" if ($verbose);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
closedir(CONFDIR);
|
closedir(CONFDIR);
|
||||||
|
|
@ -67,5 +108,6 @@ if (opendir (CONFDIR,$confdir)) {
|
||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
print "\nFinished.\n" if ($verbose);
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue