<p>That's an interesting approach. It's probably cheaper than a Raspberry Pi.</p>

<ol>
<li><p>Put your startup script in a file:</p>

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

<p>Save to <code>start_single.sh</code>, then</p>

<pre><code>$ chmod u+x start_single.sh
</code></pre></li>
<li><p>Make the final script:</p>

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

<p>Save as <code>start_all.sh</code>, then</p>

<pre><code>$ chmod u+x start_all.sh
</code></pre></li>
<li><p>Run <code>./start_all.sh</code> to mine. </p></li>
</ol>

<p>If you want to start the script on startup, google 'TomatoUSB start program on startup'</p>

CC BY-SA 3.0
2013-07-26T18:02:03.183Z
Script works well and I have a number of Block Erupters connected, each feeding one process. Though I am getting a higher-than-expected error rate. For example, for every 1000 accepted blocks I'm getting only one or two rejected blocks but anywhere between 25 and 50 "HW" (hardware I suppose?) errors.  According to my pool I am still producing at the advertised rate. I may try to turn up debugging in cgminer to see what's happening.
Ryan
CC BY-SA 3.0
2013-07-23T00:07:26.477Z
2013-07-23T00:07:26.477Z
Nick ODell
<p>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.</p>

<p>Am finding some curious behaviors using <a href="https://www.dropbox.com/s/op3k7zc8grh751h/cgminer-3.3.1-mipsel.tar.gz" rel="nofollow">this</a> cgminer 3.3.1 binary as so:</p>

<pre><code>./cgminer -o pool:port -u username.worker -p password
</code></pre>

<p>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. </p>

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

<p>(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.</p>

<p>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?</p>

<cgminer><asic>
Scripting multiple cgminer processes / running on a router
Ryan
# Scripting multiple cgminer processes / running on a router

(Asked by: username_0 on 2013-07-22)

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](https://www.dropbox.com/s/op3k7zc8grh751h/cgminer-3.3.1-mipsel.tar.gz) 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?

**Tags:** cgminer, asic


---

## 1 answers

### Answer by username_1 on 2013-07-23. Score: 1

That's an interesting approach. It's probably cheaper than a Raspberry Pi.

1. 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

   ```
2. 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

   ```
3. Run `./start_all.sh` to mine.

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

> **Comments:**
> **username_0**: Script works well and I have a number of Block Erupters connected, each feeding one process. Though I am getting a higher-than-expected error rate. For example, for every 1000 accepted blocks I'm getting only one or two rejected blocks but anywhere between 25 and 50 "HW" (hardware I suppose?) errors.  According to my pool I am still producing at the advertised rate. I may try to turn up debugging in cgminer to see what's happening.  

---

