Is there any way to get immediate data out of a Phoenix instance - for example, the hashrate, the results accepted / rejected, and the last status message / timestamp?
Or, since I'm not a Linux god (my Unix skills come from being a Mac OS X guru) - is there any funky file type I can use that I can send the stdout from Phoenix to, and be able to read it from Ruby, but can be 'trimmed' on regular occasions (i.e. removing the old entries), or one that can be set to a specific size which it won't grow any larger than? Sort of like a FIFO but allowing, say, 32K of log text to build up before dropping the first bytes in?
So, I liked that question for some reason. (most likly cause I had a similar problem.)
Here is a little perl script:
#!/usr/bin/perl
my @s;
$/ = "\b";
while(<>){
next if(! m/^\[/);
chomp;
print "$_\n";
if(push(@s,$_) > 20 or m/(Result|New Work)/ ){
open(FH,">>","out.log");
print FH join("\n",@s)."\n";
close FH;
@s = ();
}
}
you'd just pipe the output of phoenix into it:
./phoenix blah blah blah |./logger
It spools up to 20 lines and writes them out to out.log
if you are parsing out.log then you'd just:
mv out.log out.log.parsing
rm out.log.parsing
and a new out.log will be created.