• Forum has been upgraded, all links, images, etc are as they were. Please see Official Announcements for more information

Save money, night mining

poiuty

Active member
In Russia, the tariff for electricity is cheaper at night.
The essential difference between the peak rates [7-00 - 10-00, 17-00 - 21-00], half-peak [10-00 - 17-00, 21-00 - 23-00] and night [23-00 - 7-00].
Code:
peak 4.92 rub. / kWh
night 1.26 rub. / kWh
half-peak 4.08 rub. / kWh

We can use rtc module to wakeup the computer. You can check it so.
Code:
echo `date '+%s' -d '+ 5 minutes'` > /sys/class/rtc/rtc0/wakealarm

Check
Code:
# cat /sys/class/rtc/rtc0/wakealarm
1426786194

# cat /proc/driver/rtc
rtc_time  : 17:25:03
rtc_date  : 2015-03-19
alrm_time  : 17:29:54
alrm_date  : 2015-03-19
alarm_IRQ  : yes
alrm_pending  : no
update IRQ enabled  : no
periodic IRQ enabled  : no
periodic IRQ frequency  : 1024
max user IRQ frequency  : 64
24hr  : yes
periodic_IRQ  : no
update_IRQ  : no
HPET_emulated  : yes
BCD  : yes
DST_enable  : no
periodic_freq  : 1024
batt_status  : okay

Turn off the computer.
Code:
shutdown -h now
After a few minutes it will start again.
So, sgminer start work at 23.00 (for cron) => /etc/cron.d/sgminer
Code:
*/10 * * * * root cd /root/status/ && ./control.php
This makes this line of code.
Code:
if(($hour >= 23 || $hour < 7) && check_sgminer() == 'no') shell_exec("cd /root/v5/ && screen -dmS mine /root/v5/start.sh > /dev/null 2>/dev/null &");

When morning comes, the script sets the time when the computer is turned on. And off it.
Code:
if($hour >= 7 && $hour < 23 && check_sgminer() == 'yes'){
$time = new DateTime(date("F j, Y, 22:55", time()));
if(time() > $time->getTimestamp()+60*10){
$time = new DateTime(date("F j, Y, 22:55", strtotime('+1 day')));
}
shell_exec("echo '".$time->getTimestamp()."' > /sys/class/rtc/rtc0/wakealarm");
sleep(5);
shell_exec("shutdown -h now");
}

https://github.com/poiuty/Simple/blob/master/wakeup/control.php
https://github.com/poiuty/Simple/blob/master/wakeup/sgminer
http://goo.gl/qYBew4
 
Its a viable alternative here in the UK but the catch is that the rate for the day rate is nearly doubled, so domestic is out really but business premises might be doable, but would only get 7 hours out of 24 to find the blocks!
 
Back
Top