Post
Topic
Board Mining (Altcoins)
Re: Official FutureBit Moonlander 2 Driver and Support Thread
by
flamman
on 10/12/2017, 22:31:29 UTC
Here is a question for our Linux/Raspbian crowd:

My plan was to run this off my RPI 3 as a headless system. I can putty in, do admin tasks, start, etc.
Trouble starts when I try to figure out how to log out & leave the pi mining.
Anyone have a good method for this?

I tried some tests with nohup command:
nohup ./startmoonlander.sh &
-
This does load bfgminer in background (with red LEDs flashing),
But not sure how to bring if forward again and worse the mining still stops when I close putty session.

Yes - I modified a script from the original bfgminer repository and saved it as miner.sh

First install screen..

Code:
apt-get install screen

Then modify in below snippet the /path/to/bfgminer, -u and -p

Code:
#!/bin/sh
n="
"
startscreen() {
name="$1"; shift
cmd="$1"; shift
if ! screen -ls | grep -q "^[[:space:]]\+[0-9]\+\.$name"; then
screen -dmS "$name"
else
for i in 1 2 3; do
screen -x "$name" -p 0 -X stuff $(echo 'x' | tr 'x' '\003')
done
screen -x "$name" -p 0 -X stuff "stty sane$n"
fi
screen -x "$name" -p 0 -X stuff "$cmd$n"
}

startscreen miner "/root/bfgminer_5.4.2-futurebit2_linux_armv6/bfgminer --scrypt -o stratum+tcp://litecoinpool.org:3333 -u -p ,d=128 -S ALL --set MLD:clock=600 --api-listen --api-network"

Save it to a file and make the file executable. Above script starts & restarts bfgminer.
You can check if it is running..

Code:
screen -list

Which then shows something like..

Code:
There is a screen on:
2139.miner (09/12/17 16:12:05) (Attached)
1 Socket in /run/screen/S-root.

You can then safely log out.
You can see the terminal output when you SSH back in by running..

Code:
screen -r

And by doing crtl+a and ctrl+d while in screen you detach again while keeping bfgminer running.
Within screen crtl+c will stop bfgminer if necessary

" --api-listen --api-network" can be left out - that is just because there I want to be able to query the API