View difference between Paste ID: LZwdxATT and SeMJwsRP
SHOW: | | - or go back to the newest paste.
1-
#!/bin/bash
1+
#!/bin/sh
2
3-
#https://bitcointalk.org/index.php?topic=2799605.msg
3+
# https://bitcointalk.org/index.php?topic=2799605.msg
4
5-
cp /config/bmminer.conf /config/bmminer.conf.backup
5+
# NOTE: You need to set your DNS server address below.
6-
cp /config/network.conf /config/network.conf.backup
6+
# Don't just hammer Google's servers when your ISP has
7
# already provided the infrastructure.
8-
rm /config/bmminer.conf
8+
DNS=""
9-
rm /config/network.conf
9+
10
[ $# -lt 5 ] && {
11-
touch /config/bmminer.conf
11+
  echo "Usage: $0 workername1 workername2 workername3 hostname ip"
12-
touch /config/network.conf
12+
  exit 1
13
}
14-
echo "{"                                                            >> /config/bmminer.conf
14+
15-
echo "\"pools\" : ["                                                            >> /config/bmminer.conf
15+
mv /config/bmminer.conf /config/bmminer.conf.backup
16-
echo "{"                                                            >> /config/bmminer.conf
16+
mv /config/network.conf /config/network.conf.backup
17-
echo "\"url\" : \"stratum.antpool.com:3333\","                                                            >> /config/bmminer.conf
17+
18-
echo "\"user\" : \"test.$1\","                                                            >> /config/bmminer.conf
18+
cat <<EOF >/config/bmminer.conf
19-
echo "\"pass\" : \"123\""                                                            >> /config/bmminer.conf
19+
{
20-
echo "},"                                                            >> /config/bmminer.conf
20+
"pools" : [ {
21-
echo "{"                                                            >> /config/bmminer.conf
21+
  "url" : "stratum.antpool.com:3333",
22-
echo "\"url\" : \"stratum.antpool.com:3333\","                                                            >> /config/bmminer.conf
22+
  "user" : "test.$1",
23-
echo "\"user\" : \"test.$2\","                                                            >> /config/bmminer.conf
23+
  "pass" : "123"
24-
echo "\"pass\" : \"123\""                                                            >> /config/bmminer.conf
24+
},
25-
echo "},"                                                            >> /config/bmminer.conf
25+
{
26-
echo "{"                                                            >> /config/bmminer.conf
26+
  "url" : "stratum.antpool.com:3333",
27-
echo "\"url\" : \"stratum.antpool.com:3333\","                                                            >> /config/bmminer.conf
27+
  "user" : "test.$2",
28-
echo "\"user\" : \"test.$3\","                                                            >> /config/bmminer.conf
28+
  "pass" : "123"
29-
echo "\"pass\" : \"123\""                                                            >> /config/bmminer.conf
29+
},
30-
echo "}"                                                            >> /config/bmminer.conf
30+
{
31-
echo "]"                                                            >> /config/bmminer.conf
31+
  "url" : "stratum.antpool.com:3333",
32-
echo ","                                                            >> /config/bmminer.conf
32+
  "user" : "test.$3",
33-
echo "\"api-listen\" : "true","                                                            >> /config/bmminer.conf
33+
  "pass" : "123"
34-
echo "\"api-network\" : "true","                                                            >> /config/bmminer.conf
34+
} ],
35-
echo "\"api-groups\" : \"A:stats:pools:devs:summary:version\","                                                            >> /config/bmminer.conf
35+
"api-listen" : "true",
36-
echo "\"api-allow\" : \"A:0/0,W:*\","                                                            >> /config/bmminer.conf
36+
"api-network" : "true",
37-
echo "\"bitmain-use-vil\" : "true","                                                            >> /config/bmminer.conf
37+
"api-groups" : "A:stats:pools:devs:summary:version",
38-
echo "\"bitmain-freq\" : \"550\","                                                            >> /config/bmminer.conf
38+
"api-allow" : "A:0/0,W:*",
39-
echo "\"bitmain-voltage\" : \"0706\","                                                            >> /config/bmminer.conf
39+
"bitmain-use-vil" : "true",
40-
echo "\"multi-version\" : \"1\""                                                            >> /config/bmminer.conf
40+
"bitmain-freq" : "550",
41-
echo "}"                                                            >> /config/bmminer.conf
41+
"bitmain-voltage" : "0706",
42
"multi-version" : "1"
43
}
44
EOF
45
46-
echo "hostname=miner$4"                    >>  /config/network.conf
46+
47-
echo "ipaddress=10.0.0.$5"                  >> /config/network.conf
47+
48-
echo "netmask=255.255.255.0"                              >> /config/network.conf
48+
cat <<EOF > /config/network.conf
49-
echo "gateway=10.0.0.138"                              >> /config/network.conf
49+
hostname=miner$4
50-
echo "dnsservers=\"8.8.8.8"\"    >> /config/network.conf
50+
ipaddress=10.0.0.$5
51
netmask=255.255.255.0
52
gateway=10.0.0.138
53
dnsservers="$DNS"
54
EOF
55
56
chmod 400 /config/network.conf
57-
#echo "root:antMiner Configuration:23c2a2d78c0d20ec069097d7d20c4392" >> /config/lighttpd-htdigest.user
57+
58
#/etc/init.d/bmminer.sh restart >/dev/null 2>&1
59
#/etc/init.d/network.sh
60
#/etc/init.d/avahi restart > /dev/null
61
#echo "root:antMiner Configuration:23c2a2d78c0d20ec069097d7d20c4392" >> /config/lighttpd-htdigest.user
62
63
exit 0