If anyone is interested in load-balancing their machine or adding any other cgminer parameters, here's how to do it:
ssh into your S2 with putty or similar software (root,admin)
...
Unfortunately, a reboot will set this all back to the default, so if anyone knows how to actually save any of the settings changed, please let me know.
I was actually trying to figure this out a couple of days ago and ran into the same problem you did. We were both trying to modify the
/etc/init.d/cgminer startup script; it's just a bad habit we picked up from modifying our S1s. (By "bad habit," I mean we learned to do it that way because the S1 used a non-standard configuration file for cgminer -- so we couldn't just plug the values into the conf file without hacking around in
init.d first.)
I don't follow (at all) why Bitmain decided to "lock down" the S2 so much, making so much stuff reset automatically -- it seems like they went out of their way to make this thing difficult to customize for my tastes. For example, on all my S1s, I used to have a couple of scripts installed locally to grab quick values from the API I was frequently looking for...and I had a couple of (very simple) cron jobs that ran twice a day, nothing earth shatteringly impressive -- but at least I could put a damned script file in my path, and modify my
.profile, and at least cron was INSTALLED. (And speaking of installation -- I will always have a fondness in my heart for vi, since that's what I first learned to use on the first UNIX-based system I ever came in contact with. But nano is easier; and on the S1 it could easily be installed from the GUI. I haven't really bothered to try to figure out how to install nano via opkg -- because I assume the damned thing would just lose any changes on reboot anyway.)
And what about my damned ssh pubkeys? Every time that stupid thing reboots I have to
ssh-copy-id my pubkey over *again*....unless I want to type the password every time I log in to do anything...which is annoying because (as anyone reading this has figured out) it would seem I am lazy as fuck. :)
*ahem* but I digress.
Fortunately, the "how do I load balance" question is easier than you think -- because the S2 (as far as I can tell) uses a standard
cgminer.conf file structure in the
/config/cgminer.conf file. If you type
ps www
you'll see that cgminer is loading directly from that file, so if you cruise over to the cgminer thread in this forum, or grab a copy of the README from github, you can see all the myriad options available... almost any option you *could* put in the cgminer commandline can be placed in the JSON-formatted
cgminer.conf file (located in
/config/)...including those needed for load balancing.
Okay okay, enough prefacing. Here's a practical (working) example taken from my S2. First, let's look at the original (NON-LOAD-BALANCED) cgminer.conf file, which is just the original one that shipped with the machine (edited with my pool info, etc):
/tmp $ ssh s2
root@s20:~# cd /config
root@s20:/config# ls
asic-freq.config dropbear network.conf
dropbear_rsa_host_key shadow cgminer.conf
lighttpd-htdigest.user cgminer.conf.bak lost+found
root@s20:/config# cat cgminer.conf.bak
{
"pools" : [
{
"url" : "stratum+tcp://stratum.btcguild.com:3333",
"user" : "sampleUsername_SampleWorker",
"pass" : "x"
},
{
"url" : "stratum+tcp://us1.ghash.io:3333",
"user" : "sampleUsername.SampleWorker",
"pass" : "x"
},
{
"url" : "stratum+tcp://uk1.ghash.io:3333",
"user" : "sampleUsername.SampleWorker",
"pass" : "x"
}
]
,
"api-listen" : true,
"api-network" : true,
"api-allow" : "W:127.0.0.1,W:192.168.1/24",
"bitmainbeeper" : true,
"bitmaintempoverctrl" : true
}
root@s20:/config#
Okay, so nothing special -- other than the mining pool details and the changes I made to the "
api-allow" line so my monitoring script could reach/query the thing, that's pretty much stock.
If you want to modify this to work in load-balance mode, per the cgminer README, you'll need to do the following:
- Add the parameter "load-balance" : true, to the conf file
- Change all the "url" lines (under the "pools" section) to "quota" lines, and modify the URL string so it contains the percentage of time you want the system to devote to each pool, then a semicolon, then the URL, like this: "quota" : "50;stratum+tcp://stratum.btcguild.com:3333",
- Look at the example below, since this explanation probably doesn't make any sense at all (but once you see an example you'll realize it's easy and you'll have yours up and running in a couple of minutes, tops).
So let's head back and look at my current (load balanced) file -- compare it with the one listed above, and you should be able to apply the same differences to yours with no problems. Note that I just want to split my S2's time between two pools -- so the third pool gets a quota of "0." That doesn't disable the third pool; it just sets it to be a backup/failover pool:
root@s20:/config# cat cgminer.conf
{
"pools" : [
{
"quota" : "50;stratum+tcp://stratum.btcguild.com:3333",
"user" : "sampleUsername_SampleWorker",
"pass" : "x"
},
{
"quota" : "50;stratum+tcp://us1.ghash.io:3333",
"user" : "sampleUsername.SampleWorker",
"pass" : "x"
},
{
"quota" : "0;stratum+tcp://uk1.ghash.io:3333",
"user" : "sampleUsername.SampleWorker",
"pass" : "x"
}
]
,
"api-listen" : true,
"api-network" : true,
"api-allow" : "W:127.0.0.1,W:192.168.1/24",
"bitmainbeeper" : true,
"bitmaintempoverctrl" : true,
"load-balance" : true
}
root@s20:/config#
Now, if anyone out there knows anything about Dropbear -- I'm assuming the reason the dropbear config file is in /config (and thus will exist across reboots) is that there must be a way to tell the ssh daemon "authenticate using the ssh keys located in
/config/authorized_keys , instead of the default, because I would like to quit copying them over every time I issue a shutdown or reboot command!" I'm assuming there must be a way to say that in the
/config/dropbear file, I just haven't had the time to go look up all the various dropbear options...so if anyone knows how to do this off the top of their head, please share!
(Or for that matter, if anyone knows how to make a larger portion of the S2's filesystem "persistent" without having to go through the trouble of writing a custom firmware for it -- that would be GREATLY appreciated. Because I would like to be able to update cgminer (and other files) when/if Kano starts releasing updated binaries for this platform, as he did with the S1. And I would like to install cron...and nano...and "whatever I damned well please" because surely the BeagleBone supports this kind of "crazy advanced behavior" ...right? Right? Anyone? I admit I know next to nothing about modifying firmware images ...this seems like *such* a step backwards from the way the S1s were setup, I wonder why? Okay, diatribe over. For now...!)I hope that gets you started, freebit13. If it's not obvious, you can use different values other than "50/50/0" for the quota -- anything like "25/25/50" works too. And it doesn't even need to add up to 100%; I just do that because it's easier for my feeble brain to keep up with the math. (Again, see the cgminer README file for explicit instructions on how this is supposed to be done -- but if you're anything like me, what you *really* needed was an example showing you a version that actually works...so here you go!) Good luck and let me know if you run into problems; I cut and pasted most of the above, so I don't *think* there are any typos, but obviously you should back up your old config file just in case.
Hope that helps!