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].
	
	
	
		
We can use rtc module to wakeup the computer. You can check it so.
	
	
	
		
Check
	
	
	
		
Turn off the computer.
	
	
	
		
After a few minutes it will start again.
So, sgminer start work at 23.00 (for cron) => /etc/cron.d/sgminer
	
	
	
		
This makes this line of code.
	
	
	
		
When morning comes, the script sets the time when the computer is turned on. And off it.
	
	
	
		
https://github.com/poiuty/Simple/blob/master/wakeup/control.php
https://github.com/poiuty/Simple/blob/master/wakeup/sgminer
http://goo.gl/qYBew4
				
			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
	So, sgminer start work at 23.00 (for cron) => /etc/cron.d/sgminer
		Code:
	
	*/10 * * * * root cd /root/status/ && ./control.php
	
		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