so here is my first script.
The first problem with the pastebin is it is looking for bash, which is not available on the control board.
#!/bin/sh
# https://bitcointalk.org/index.php?topic=2799605.msg
# NOTE: You need to set your DNS server address below.
# Don't just hammer Google's servers when your ISP has
# already provided the infrastructure.
DNS=""
[ $# -lt 5 ] && {
echo "Usage: $0 workername1 workername2 workername3 hostname ip"
exit 1
}
mv /config/bmminer.conf /config/bmminer.conf.backup
mv /config/network.conf /config/network.conf.backup
cat <<EOF >/config/bmminer.conf
{
"pools" : [ {
"url" : "stratum.antpool.com:3333",
"user" : "test.$1",
"pass" : "123"
},
{
"url" : "stratum.antpool.com:3333",
"user" : "test.$2",
"pass" : "123"
},
{
"url" : "stratum.antpool.com:3333",
"user" : "test.$3",
"pass" : "123"
} ],
"api-listen" : "true",
"api-network" : "true",
"api-groups" : "A:stats:pools:devs:summary:version",
"api-allow" : "A:0/0,W:*",
"bitmain-use-vil" : "true",
"bitmain-freq" : "550",
"bitmain-voltage" : "0706",
"multi-version" : "1"
}
EOF
chmod 400 /config/bmminer.conf
cat <<EOF > /config/network.conf
hostname=miner$4
ipaddress=10.0.0.$5
netmask=255.255.255.0
gateway=10.0.0.138
dnsservers="$DNS"
EOF
chmod 400 /config/network.conf
#/etc/init.d/bmminer.sh restart >/dev/null 2>&1
#/etc/init.d/network.sh
#/etc/init.d/avahi restart > /dev/null
#echo "root:antMiner Configuration:23c2a2d78c0d20ec069097d7d20c4392" >> /config/lighttpd-htdigest.user
exit 0
https://pastebin.com/LZwdxATTI tidied it up and removed Google's servers – you shouldn't be using them unless you need to. In fact: if you have a large number of miners you really should be using your own caching DNS server to improve performance. A Raspberry Pi is overkill for such an application so anything would do.
This could be improved dramatically but I simply couldn't be bothered. Please note that there is no automation here at all, it's simply a setup script. A better script wouldn't need to run on the miner itself. I might look at this later, but probably not.
Automating this whole process would be an entirely different script, but that's for another day.