Scripting multiple cgminer processes / running on a router I'm running TomatoUSB (a Linux-based firmware) on a Broadcom-based home router. Connected to the router's USB port is a 7-port D-Link hub and a number of Asicminer USB Block Erupters.

Am finding some curious behaviors using this cgminer 3.3.1 binary as so:

./cgminer -o pool:port -u username.worker -p password


A single cgminer instantiation will crunch at the advertised 333 MH/s rate if one USB device is connected. But that number drops off precipitously when additional devices are added. 

Interestingly, adding the "--usb :1" flag (which restricts the process to using one hotplug device) and then firing n processes this way gives me 333*n as hoped.

(I think) I need a worker for each process (not a huge issue I suppose). However on a headless system as this is, running these separately can get unwieldy very quickly. Currently I'm running one SSH client window for each process and firing each from the command line.

Is there a convenient way to script a number of these to be fired at once, each using one hotplug device, and hopefully redirecting the numerous console outputs somewhere useful? Maybe somehow share a configuration file among many processes?
That's an interesting approach. It's probably cheaper than a Raspberry Pi.


Put your startup script in a file:

./cgminer -o pool:port -u username.worker -p password --usb :$1


Save to start_single.sh, then

$ chmod u+x start_single.sh

Make the final script:

NUM_MINERS = 7
cd "$(dirname "$0")"
parallel -j $NUM_MINERS -- ./start_single.sh $(seq 1 $NUM_MINERS)


Save as start_all.sh, then

$ chmod u+x start_all.sh

Run ./start_all.sh to mine. 


If you want to start the script on startup, google 'TomatoUSB start program on startup'