Bitcoin Forum

Bitcoin => Mining => Topic started by: Intention on January 17, 2012, 12:41:47 AM



Title: Scheduling Mining
Post by: Intention on January 17, 2012, 12:41:47 AM
First I have no idea if this is in the right section but who knows.

Currently I have 2 small rigs and 1 gaming pc that I use for mining on the off time.  The two small computers are running BAMT which if I remember correctly is Debian based.  Is there a way through Crontab and other magic to schedule the 2 computers to go to sleep/hibernate whatever the Linux equivalent is at certain times and mine during others?  The motherboards in the system support Wake On Lan so I can theoretically wake them up from my gaming pc I just never had to use that feature before or how to work this out.

This is simply to keep my parental overlords happy since we get charged a dynamic rate for electricity: $0.045 Kw/H Offpeak, $0.068 Kw/H Mid, $0.11 Kw/H for high demand times so I'm willing to take the small cutback in BTC per day which might actually save me money considering the huge spike in costs for 6hours per day I just haven't done the math.

At any rate does anybody know if using Crontab to shut down mining and put them into sleep at specified times during the day and waking them up remotely would work or is this not possible?


Title: Re: Scheduling Mining
Post by: grue on January 17, 2012, 01:31:49 AM
set up a crontab that kills the miner process?


Title: Re: Scheduling Mining
Post by: stevegee58 on January 17, 2012, 01:34:23 AM
cgminer has a time scheduler built in, no fussing with cron and the like.


Title: Re: Scheduling Mining
Post by: DeathAndTaxes on January 17, 2012, 01:39:01 AM
hardest version:
putting rig to sleep and waking it backup.  bad news is if it fails to wakeup no mining.

easier version:
keep rig on idle 24/7 and just setup crontab to start and kill mining process at times you want.

easiest version:
setup cgminer to mine only hours you want.


Title: Re: Scheduling Mining
Post by: Intention on January 17, 2012, 02:26:40 AM
I figured the easiest is to just kill the process and start it up at certain times, I thought I could one up that and put it into sleep and actually put the wake on lan feature to use but running idle would still use less power.  I'll give it a go that way and see how it turns out thanks for the suggestion.


Title: Re: Scheduling Mining
Post by: The LT on January 17, 2012, 11:27:18 AM
You can use the RTC wakeup feature in Linux  to wake the PC up and shut it down. It's done by writing epoch-data to the /proc filenodes corresponding to the onboard RTC. There is a manual on the internet somewhere. I have done it a couple of times for cold reboots. Here's a sample script i've used.

Code:
#!/bin/bash

RESTARTDATE=`date +%Y-%m-%d`
RESTARTTIME=`date +%H:%M:%S -d "+130 seconds"`
RESTARTDT=`date -d "$RESTARTDATE $RESTARTTIME" "+%s"`

echo 0 > /sys/class/rtc/rtc0/wakealarm
echo $RESTARTDT > /sys/class/rtc/rtc0/wakealarm
poweroff

This simply restarts the system after 130 seconds. Doesn't work on ALL mobos, but works on the vast majority of them.

Hope this helps,


Title: Re: Scheduling Mining
Post by: Intention on January 17, 2012, 01:31:37 PM
You can use the RTC wakeup feature in Linux  to wake the PC up and shut it down. It's done by writing epoch-data to the /proc filenodes corresponding to the onboard RTC. There is a manual on the internet somewhere. I have done it a couple of times for cold reboots. Here's a sample script i've used.

Code:
#!/bin/bash

RESTARTDATE=`date +%Y-%m-%d`
RESTARTTIME=`date +%H:%M:%S -d "+130 seconds"`
RESTARTDT=`date -d "$RESTARTDATE $RESTARTTIME" "+%s"`

echo 0 > /sys/class/rtc/rtc0/wakealarm
echo $RESTARTDT > /sys/class/rtc/rtc0/wakealarm
poweroff

This simply restarts the system after 130 seconds. Doesn't work on ALL mobos, but works on the vast majority of them.

Hope this helps,
Thanks LT I'll fiddle around with that later tonight, right now I'm just using Crontab to turn /init.d/mine on and off which is working so far.


Title: Re: Scheduling Mining
Post by: rjk on January 17, 2012, 02:30:45 PM
easiest version:
setup cgminer to mine only hours you want.
^This


Title: Re: Scheduling Mining
Post by: The LT on January 18, 2012, 12:52:44 PM
You can use the RTC wakeup feature in Linux  to wake the PC up and shut it down. It's done by writing epoch-data to the /proc filenodes corresponding to the onboard RTC. There is a manual on the internet somewhere. I have done it a couple of times for cold reboots. Here's a sample script i've used.

*snip*

Hope this helps,
Thanks LT I'll fiddle around with that later tonight, right now I'm just using Crontab to turn /init.d/mine on and off which is working so far.

This won't solve the idle power consumption issue, now will it? :) Even with C-states, the system consumes quite a bit of electricity. When you first try the script, don't forget to enable the on-board timer in BIOS.


Title: Re: Scheduling Mining
Post by: Intention on January 19, 2012, 05:54:12 AM
Currently it's roughly 200 Watts with the 5850, idle not mining it's hovering around ~85watts.  I don't know what it would be like in any sort of sleep but I have a feeling it would be less than just running idle.  I could have it just auto shut off with cron but I'm not always around to turn it back on, and that just seems stupid at that point.


Title: Re: Scheduling Mining
Post by: The LT on January 22, 2012, 02:40:02 AM
Currently it's roughly 200 Watts with the 5850, idle not mining it's hovering around ~85watts.  I don't know what it would be like in any sort of sleep but I have a feeling it would be less than just running idle.  I could have it just auto shut off with cron but I'm not always around to turn it back on, and that just seems stupid at that point.

Just to clarify...

The whole idea of my script is that you can completely power off the system and have it wake up at a predefined time. This BIOS option is available on most modern motherboards and it can be directly programmed from Linux. You can actually set the exact time of system wakeup. Using the script, you can set the timer to the desired wakeup time and then immediately shutdown the system. It will power on, boot and start mining using cgminer. You can then program cgminer to mine for a specified amount of time and then execute the poweroff script again... Simple. If you need to wake your system at regular intervals you don't even need any script at all, actually...


Title: Re: Scheduling Mining
Post by: Intention on January 22, 2012, 12:26:49 PM
Currently it's roughly 200 Watts with the 5850, idle not mining it's hovering around ~85watts.  I don't know what it would be like in any sort of sleep but I have a feeling it would be less than just running idle.  I could have it just auto shut off with cron but I'm not always around to turn it back on, and that just seems stupid at that point.

Just to clarify...

The whole idea of my script is that you can completely power off the system and have it wake up at a predefined time. This BIOS option is available on most modern motherboards and it can be directly programmed from Linux. You can actually set the exact time of system wakeup. Using the script, you can set the timer to the desired wakeup time and then immediately shutdown the system. It will power on, boot and start mining using cgminer. You can then program cgminer to mine for a specified amount of time and then execute the poweroff script again... Simple. If you need to wake your system at regular intervals you don't even need any script at all, actually...

Sorry I misunderstood what that bash script did.  I found my motherboards manual and did find the option to "Power On By RTC Alarm" so I'm assuming it will work.  In the mean time I'll look up more information on RTC and what not so I don't look like a complete idiot. :)