Post
Topic
Board Mining support
Re: Antminer S2 Support and Overclocking Thread
by
Hyacin75
on 08/08/2014, 08:32:06 UTC
Modified with a time of day asic speed schedule -

Code:
#!/usr/bin/perl

use strict;

my %schedule = (
        0 => [ 218, 218,218,218,218,218,218, 218,218,218,218,218,218, 218,218,206,206,206,206, 206,218,218,218,218, ],
        1 => [ 218, 218,218,218,218,218,218, 218,218,218,218,218,218, 218,218,206,206,206,206, 206,218,218,218,218, ],
        2 => [ 218, 218,218,218,218,218,218, 218,218,206,206,206,206, 206,206,196,196,196,196, 196,206,206,206,196, ],
        3 => [ 196, 196,196,196,196,196,196, 196,196,206,206,206,206, 206,206,196,196,196,196, 196,206,206,206,196, ],
        4 => [ 196, 196,196,196,196,196,196, 196,196,206,206,206,206, 206,206,196,196,196,196, 196,206,206,206,196, ],
        5 => [ 196, 196,196,196,196,196,196, 196,196,206,206,206,206, 206,206,206,206,206,206, 206,218,218,218,218, ],
        6 => [ 218, 218,218,218,218,218,218, 218,218,218,218,218,218, 218,218,206,206,206,206, 206,218,218,218,218 ],
);

my ($hour, $wday) = (localtime(time))[2,6];

my $s2pooldata = `echo "pools|" | nc 192.168.1.99 4028`;
chomp($s2pooldata);
my $currclock = `sshpass -p 'admin' ssh -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no root\@192.168.1.99 ps w | grep 115200 | grep bitmain | grep -v grep | tr -s ' ' ' ' | cut -d'-' -f2- | cut -d' ' -f4 | cut -d':' -f5`;
chomp($currclock);

my $RESTART = 0;

if ( $s2pooldata =~ /btcguild/ ) {
        system("sshpass -p 'admin' scp -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no /path/to/s2-cgminer.conf root\@192.168.1.99:/config/cgminer.conf");
        $RESTART = 1;
}

if ( $currclock !~ /${$schedule{$wday}}[$hour]/ ) {
        my $asicfile = "asic-freq.config." . ${$schedule{$wday}}[$hour];
        system("sshpass -p 'admin' scp -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no /path/to/$asicfile root\@192.168.1.99:/config/asic-freq.config");
        system("sshpass -p 'admin' ssh -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no root\@192.168.1.99 cp /config/asic-freq.config /etc/asic-freq.config");
        $RESTART = 1;
}

if ( $RESTART == 1 ) {
        system("sshpass -p 'admin' ssh -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no root\@192.168.1.99 /etc/init.d/cgminer.sh stop");
        sleep 5;
        system("sshpass -p 'admin' ssh -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no root\@192.168.1.99 /etc/init.d/cgminer.sh start");
}


In my case I use it to keep my room from getting insanely hot while I'm here and more specifically, while I'm trying to sleep (like I would and should be right now if the room wasn't insanely hot from it running at 206, lol) ... could be useful for anyone on time of day hydro billing though if they wanted to run it at lower clocks during the more expensive times ...


This requires, for my specific schedule values -

s2-cgminer.conf
asic-freq.config.196
asic-freq.config.206
asic-freq.config.218

files to be in the current directory or an absolute path to them specified ...