This tutorial may be outdated. It is no longer recommended for beginners, and may need modifications to code or hardware that is not indicated in the tutorial.

Configure Auto-start

Now that you've tested and confirmed your miner is working, we can set it to begin mining automatically on startup. To do so, we'll need to edit a file named rc.local.

Open rc.local in the nano editor by entering the following command:
Download: file
sudo nano /etc/rc.local
We'll need to add our custom startup commands above the last line which reads "exit 0"

The block of code shown below will start PiMiner & cgminer using two USB Block Erupters and is similar to what we used to start mining manually.

Simply replace the last line with the command you used to start cgminer earlier, but remove the leading "sudo"
Download: file
cd /home/pi/PiMiner
python &
cd ..
nohup ./cgminer-3.1.1/cgminer --config /home/pi/cgminer.conf -S /dev/ttyUSB0 -S /dev/ttyUSB1 >/dev/null 2>&1&
Paste the updated code into the nano editor above "exit 0" so that it looks like the following:
Once you've finished updating the file, do the following:

  1. press ctl+x to begin exiting the file
  2. press y to confirm changes
  3. press return to save the file
Now when the Pi boots up, it will automatically start cgminer & the PiMiner scripts.
Note: the mining startup process can take a minute or two, during which you may notice your mining devices start, go idle, and then start again.
This guide was first published on Jun 20, 2013. It was last updated on Jun 20, 2013. This page (Configure Auto-start) was last updated on May 04, 2015.