Saturday, February 7, 2009

watchShutdownLogs.pl

I wrote this little script that really helps with testing dynamic store loading:

INVOKE AS:
watch -n 2 --differences=cumulative 'perl /root/watchShutdownLogs'



#!/usr/bin/perl


@fileList = `find /usr/local/pi/hosting/data/*/config/shutdown.pinode.conf`;
foreach $x (@fileList)
{
$x =~ m/data\/(.+)\/config/;
$y = $1;
print "$y \n";

printFile($x);
print "\n";

}


sub printFile
{
my $filename = $_[0];

open( FILE, $filename ) or die "Can't open $filename : $!";

while( ) {
if (m/store/)
{print $_;}
}

close FILE;
}

No comments: