chia.sh 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594
  1. #!/bin/bash
  2. #set -e
  3. Version=6.0.1
  4. Gui=No #can be Yes No or Only
  5. GigaHorse_farmer=Yes
  6. MadMax=Yes
  7. GigaHorse=Yes
  8. BladeBit=No
  9. ChiaPos=Yes
  10. H9_ChiaService=No
  11. H9_Miner=No
  12. H9_ChiaProxy=No
  13. FoxyPool=Yes
  14. function print_centered {
  15. [[ $# == 0 ]] && return 1
  16. declare -i TERM_COLS="$(tput cols)"
  17. declare -i str_len="${#1}"
  18. [[ $str_len -ge $TERM_COLS ]] && {
  19. echo "$1";
  20. return 0;
  21. }
  22. declare -i filler_len="$(( (TERM_COLS - str_len) / 2 ))"
  23. [[ $# -ge 2 ]] && ch="${2:0:1}" || ch=" "
  24. filler=""
  25. for (( i = 0; i < filler_len; i++ )); do
  26. filler="${filler}${ch}"
  27. done
  28. printf "%s%s%s" "$filler" "$1" "$filler"
  29. [[ $(( (TERM_COLS - str_len) % 2 )) -ne 0 ]] && printf "%s" "${ch}"
  30. printf "\n"
  31. return 0
  32. }
  33. #function jumpto
  34. #{
  35. # label=$1
  36. # cmd=$(sed -n "/$label:/{:a;n;p;ba};" $0 | grep -v ':$')
  37. # eval "$cmd"
  38. # exit
  39. #}
  40. function simplify_config {
  41. error_flag=0
  42. Gui=${Gui^^}
  43. H9_ChiaService=${H9_ChiaService^^}
  44. MadMax=${MadMax^^}
  45. GigaHorse=${GigaHorse^^}
  46. GigaHorse_farmer=${GigaHorse_farmer^^}
  47. BladeBit=${BladeBit^^}
  48. ChiaPos=${ChiaPos^^}
  49. H9_Miner=${H9_Miner^^}
  50. H9_ChiaProxy=${H9_ChiaProxy^^}
  51. FoxyPool=${FoxyPool^^}
  52. if [[ "$Gui" == "YES" ]] || [[ "$Gui" == "NO" ]] || [[ "$Gui" == "ONLY" ]];then error_flag=$((error_flag+0));else error_flag=$((error_flag+1)) ;fi
  53. if [[ "$MadMax" == "YES" ]] || [[ "$MadMax" = "NO" ]];then error_flag=$((error_flag+0));else error_flag=$((error_flag+1)) ;fi
  54. if [[ "$GigaHorse" == "YES" ]] || [[ "$GigaHorse" == "NO" ]];then error_flag=$((error_flag+0));else error_flag=$((error_flag+1));fi
  55. if [[ "$GigaHorse_farmer" == "YES" ]] || [[ "$GigaHorse_farmer" == "NO" ]];then error_flag=$((error_flag+0));else error_flag=$((error_flag+1));fi
  56. if [[ "$BladeBit" == "YES" ]] || [[ "$BladeBit" == "NO" ]];then error_flag=$((error_flag+0));else error_flag=$((error_flag+1));fi
  57. if [[ "$ChiaPos" == "YES" ]] || [[ "$ChiaPos" == "NO" ]];then error_flag=$((error_flag+0));else error_flag=$((error_flag+1));fi
  58. if [[ "$H9_ChiaService" == "YES" ]] || [[ "$H9_ChiaService" == "NO" ]];then error_flag=$((error_flag+0));else error_flag=$((error_flag+1));fi
  59. if [[ "$H9_Miner" == "YES" ]] || [[ "$H9_Miner" == "NO" ]];then error_flag=$((error_flag+0));else error_flag=$((error_flag+1));fi
  60. if [[ "$H9_ChiaProxy" == "YES" ]] || [[ "$H9_ChiaProxy" == "NO" ]];then error_flag=$((error_flag+0));else error_flag=$((error_flag+1));fi
  61. if [[ "$FoxyPool" == "YES" ]] || [[ "$FoxyPool" == "NO" ]];then error_flag=$((error_flag+0));else error_flag=$((error_flag+1));fi
  62. }
  63. function intro_ {
  64. export TERM=xterm-256color
  65. print_centered "$(tput setaf 10)"
  66. print_centered " ______ __ __ "
  67. print_centered "| | |--.|__|.---.-."
  68. print_centered "| ---| || || _ |"
  69. print_centered "|______|__|__||__||___._|"
  70. echo -n "$(tput sgr0)"
  71. print_centered "Toolkit for Chia v$Version"
  72. echo ""
  73. if [ $error_flag -ne 0 ]
  74. then
  75. echo -n "$(tput setaf 1 ;tput blink;tput bold)"
  76. print_centered "Config Error !!! $error_flag"
  77. echo -n "$(tput sgr0)"
  78. exit 0
  79. fi
  80. case $Gui in
  81. YES)
  82. echo -n "$(tput setaf 40)"
  83. print_centered "Blockchain wallet + Gui"
  84. echo -n "$(tput sgr0)"
  85. echo -n "$(tput setaf 11)"
  86. print_centered "Chia Plotting Tools"
  87. echo -n "$(tput sgr0)"
  88. ;;
  89. NO)
  90. echo -n "$(tput setaf 11)"
  91. print_centered "Chia Plotting Tools"
  92. echo -n "$(tput sgr0)"
  93. ;;
  94. ONLY)
  95. echo -n "$(tput setaf 41)"
  96. print_centered "Blockchain + GUI wallet Only"
  97. echo -n "$(tput sgr0)"
  98. ;;
  99. *)
  100. echo -n "$(tput setaf 1 ;tput blink;tput bold)"
  101. print_centered "Config Error !!!"
  102. echo -n "$(tput sgr0)"
  103. exit 0
  104. ;;
  105. esac
  106. if [ $Gui = "NO" ] || [ $Gui = "YES" ]
  107. then
  108. case $GigaHorse_farmer in
  109. YES)
  110. echo -n "$(tput setaf 42)"
  111. print_centered "GigaHorse Farmer"
  112. echo -n "$(tput sgr0)"
  113. ;;
  114. esac
  115. case $H9_ChiaService in
  116. YES)
  117. echo -n "$(tput setaf 43)"
  118. print_centered "Mining service Enabled"
  119. echo -n "$(tput sgr0)"
  120. ;;
  121. esac
  122. case $H9_ChiaProxy in
  123. YES)
  124. echo -n "$(tput setaf 43)"
  125. print_centered "Hpool x-Proxy Enabled"
  126. echo -n "$(tput sgr0)"
  127. ;;
  128. esac
  129. case $FoxyPool in
  130. YES)
  131. echo -n "$(tput setaf 44)"
  132. print_centered "FoxyPool"
  133. echo -n "$(tput sgr0)"
  134. ;;
  135. esac
  136. fi
  137. sleep 2
  138. if ! [ -d /home/wareck/chia ];then mkdir /home/wareck/chia;fi
  139. }
  140. function GigaHorse_farmer_ {
  141. echo -e "$(tput setaf 10)\nInstall GigaHorse Farmer$(tput sgr0)"
  142. if ! [ -d /home/wareck/blockchain ];then mkdir /home/wareck/blockchain;fi
  143. cd /home/wareck/blockchain/
  144. GigaHorse_link=https://github.com/madMAx43v3r/chia-gigahorse/releases/download/v2.1.1.giga25/chia-gigahorse-farmer-2.1.1.giga25-x86_64.tar.gz
  145. wget -c -q --show-progress $GigaHorse_link -O chia-gigahorse-farmer.tar.gz
  146. tar xfz chia-gigahorse-farmer.tar.gz --checkpoint=.1000
  147. rm chia-gigahorse-farmer.tar.gz
  148. echo -e "\n\e[97mDone.\e[0m"
  149. }
  150. function update_ {
  151. echo -e "$(tput setaf 10)\nUpdate and install packages:$(tput sgr0)"
  152. extend="libgomp1 ocl-icd-opencl-dev libgmp-dev libnuma-dev"
  153. sudo apt-get install python3-venv python3-distutils python3-dev libsodium-dev $extend -y
  154. echo -e "\e[97mDone.\e[0m"
  155. }
  156. function chia_plotter {
  157. echo -e "$(tput setaf 10)\nBuild Chia-Plotter (MadMax4ever) :$(tput sgr0)"
  158. sleep 1
  159. cd /home/wareck/chia/
  160. if [ ! -d chia-plotter ]
  161. then
  162. git clone https://github.com/madMAx43v3r/chia-plotter.git
  163. else
  164. cd /home/wareck/chia/chia-plotter
  165. git pull
  166. fi
  167. cd /home/wareck/chia/chia-plotter
  168. git submodule init
  169. git submodule update
  170. ./make_devel.sh
  171. cd build
  172. if [ -f go.sh ];then rm go.sh ;fi
  173. cat <<'EOF'>> go.sh
  174. #!/bin/bash
  175. POOL=a99e72c49c5ed39bf793caab9e074a80dd61011a859e975842874aab47b783f9ce84282febe2ca275c0930149b67990a
  176. FARM=8ba5acd276b45fd0f749ce195dcddcf0e63c3bf2e751e9e273faa0125075c36a11f2ee231e7cf74abed2920be97fc373
  177. OUT=/media/Partage/Plots/
  178. ./chia_plot -p $POOL -f $FARM -n 1 -r 6 -u 128 -t /nvme0/plotting/ -2 /nvme0/plotting/ -d $OUT
  179. EOF
  180. chmod +x go.sh
  181. if [ -f nft.sh ];then rm nft.sh; fi
  182. cat <<'EOF'>> nft.sh
  183. #!/bin/bash
  184. POOL=a99e72c49c5ed39bf793caab9e074a80dd61011a859e975842874aab47b783f9ce84282febe2ca275c0930149b67990a
  185. FARM=8ba5acd276b45fd0f749ce195dcddcf0e63c3bf2e751e9e273faa0125075c36a11f2ee231e7cf74abed2920be97fc373
  186. OUT=/media/Partage/Plots-nft/
  187. ./chia_plot -p $POOL -f $FARM -n 1 -r 4 -u 128 -t /nvme0/plotting/ -2 /nvme1/plotting/ -d $OUT
  188. EOF
  189. chmod +x nft.sh
  190. if [ -f foxy.sh ];then rm foxy.sh; fi
  191. cat <<'EOF'>> foxy.sh
  192. #!/bin/bash
  193. POOL=a99e72c49c5ed39bf793caab9e074a80dd61011a859e975842874aab47b783f9ce84282febe2ca275c0930149b67990a
  194. FARM=8ba5acd276b45fd0f749ce195dcddcf0e63c3bf2e751e9e273faa0125075c36a11f2ee231e7cf74abed2920be97fc373
  195. OUT=/media/Partage/Plots-nft/
  196. ./chia_plot -p $POOL -f $FARM -n 1 -r 4 -u 128 -t /nvme0/plotting/ -2 /nvme1/plotting/ -d $OUT
  197. EOF
  198. chmod +x foxy.sh
  199. echo -e "\e[97mDone.\e[0m"
  200. }
  201. function bladebit {
  202. echo -e "$(tput setaf 10)\nBuild Bladebit v2 :$(tput sgr0)"
  203. sleep 1
  204. cd /home/wareck/chia
  205. if [ ! -d bladebit ]
  206. then
  207. git clone https://github.com/Chia-Network/bladebit.git
  208. fi
  209. cd /home/wareck/chia/bladebit/
  210. if [ ! -d build ];then mkdir build;fi
  211. cd build
  212. sed -i "s/FatalIf( cfg.compressionLevel >/\/\/FatalIf( cfg.compressionLevel/g" /home/wareck/chia/bladebit/src/main.cpp
  213. cmake ..
  214. make -j 6
  215. if [ -f cuda.sh ]; then rm cuda.sh ;fi
  216. cat <<'EOF'>> cuda.sh
  217. #!/bin/bash
  218. POOL=a99e72c49c5ed39bf793caab9e074a80dd61011a859e975842874aab47b783f9ce84282febe2ca275c0930149b67990a
  219. FARM=8ba5acd276b45fd0f749ce195dcddcf0e63c3bf2e751e9e273faa0125075c36a11f2ee231e7cf74abed2920be97fc373
  220. OUT=/farm/farm0/Plots
  221. for i in {1..5}
  222. do
  223. ./bladebit_cuda --no-direct-io -p $POOL -f $FARM -z 7 cudaplot -d 0 --disk-16 -t1 /raid/plotting $OUT
  224. done
  225. #sudo reboot
  226. #/home/wareck/miners/chia-miner/hpool-miner-chia -config /home/wareck/miners/chia-miner/config.yaml
  227. EOF
  228. if [ -f flex.sh ]; then rm flex.sh ;fi
  229. cat <<'EOF'>> flex.sh
  230. #!/bin/bash
  231. CRT=xch10yjksfwm8s66z32qy35x950608hk8l67vmsur4rwpaanpkd6ks3qhfw5nk
  232. FRM=8ba5acd276b45fd0f749ce195dcddcf0e63c3bf2e751e9e273faa0125075c36a11f2ee231e7cf74abed2920be97fc373
  233. OUT=/media/Partage/Plots-nft/
  234. ./bladebit -f $FRM -c $CRT diskplot --cache 100G -t1 /nvme1/plotting/ -t2 /nvme1/plotting/ $OUT
  235. EOF
  236. if [ -f foxy.sh ]; then rm foxy.sh ;fi
  237. cat <<'EOF'>> foxy.sh
  238. #!/bin/bash
  239. CRT=xch10yjksfwm8s66z32qy35x950608hk8l67vmsur4rwpaanpkd6ks3qhfw5nk
  240. FRM=8ba5acd276b45fd0f749ce195dcddcf0e63c3bf2e751e9e273faa0125075c36a11f2ee231e7cf74abed2920be97fc373
  241. OUT=/media/Partage/Plots-nft/
  242. ./bladebit -f $FRM -c $CRT diskplot --cache 100G -t1 /nvme1/plotting/ -t2 /nvme1/plotting/ $OUT
  243. EOF
  244. chmod +x cuda.sh
  245. chmod +x flex.sh
  246. chmod +x foxy.sh
  247. echo -e "\e[97mDone.\e[0m"
  248. }
  249. function gigahorse {
  250. echo -e "$(tput setaf 10)\nMadMax4ever GigaHorse:$(tput sgr0)"
  251. sleep 1
  252. if [ -d /home/wareck/chia/chia-gigahorse ]
  253. then
  254. cd /home/wareck/chia/chia-gigahorse
  255. git pull
  256. else
  257. cd /home/wareck/chia/
  258. git clone https://github.com/madMAx43v3r/chia-gigahorse.git
  259. fi
  260. echo "generate bash files..."
  261. sudo cp ~/chia/chia-gigahorse/plot-sink/linux/x86_64/* /usr/local/bin/
  262. sudo cp ~/chia/chia-gigahorse/cpu-plotter/linux/x86_64/* /usr/local/bin/
  263. sudo cp ~/chia/chia-gigahorse/chiapos/linux/x86_64/ProofOfSpace /usr/local/bin/
  264. cd ~
  265. if [ -f distrib_chia.sh ];then sudo rm distrib_chia.sh;fi
  266. if [ -f /usr/local/bin/distrib_chia.sh ];then sudo rm /usr/local/bin/distrib_chia.sh;fi
  267. cat <<'EOF'>> distrib_chia.sh
  268. #!/bin/bash
  269. echo "IP : $(hostname -I)"
  270. chia_plot_sink -p 1447 /farm/farm0/Plots-nft/ /farm/farm1/Plots-nft/ /farm/farm2/Plots-nft/ /farm/farm3/Plots-nft/ /farm/farm4/Plots-nft/ /Partage/Plots-nft/
  271. EOF
  272. chmod +x distrib_chia.sh
  273. sudo mv distrib_chia.sh /usr/local/bin/
  274. if [ -f go.sh ];then rm go.sh;fi
  275. cat <<'EOF'>> ~/go.sh
  276. #!/bin/bash
  277. CRT=xch10yjksfwm8s66z32qy35x950608hk8l67vmsur4rwpaanpkd6ks3qhfw5nk
  278. FRM=8ba5acd276b45fd0f749ce195dcddcf0e63c3bf2e751e9e273faa0125075c36a11f2ee231e7cf74abed2920be97fc373
  279. OUT=@192.168.1.100
  280. ./chia_plot -c $CRT -f $FRM -G -r 6 -z 1447 -C 8 -n -1 -t /nvme0/plotting/ -2 /nvme1/plotting/ -d $OUT
  281. EOF
  282. chmod +x ~/go.sh
  283. cp ~/go.sh ~/chia/chia-gigahorse/cpu-plotter/linux/x86_64/
  284. rm ~/go.sh
  285. cat <<'EOF'>> ~/foxy.sh
  286. #!/bin/bash
  287. CRT=xch10yjksfwm8s66z32qy35x950608hk8l67vmsur4rwpaanpkd6ks3qhfw5nk
  288. FRM=8ba5acd276b45fd0f749ce195dcddcf0e63c3bf2e751e9e273faa0125075c36a11f2ee231e7cf74abed2920be97fc373
  289. OUT=@192.168.1.100
  290. ./chia_plot -c $CRT -f $FRM -G -r 6 -z 1447 -C 8 -n -1 -t /nvme0/plotting/ -2 /nvme1/plotting/ -d $OUT
  291. EOF
  292. chmod +x ~/foxy.sh
  293. cp ~/foxy.sh ~/chia/chia-gigahorse/cpu-plotter/linux/x86_64/
  294. rm ~/foxy.sh
  295. echo -e "\e[97mDone.\e[0m"
  296. }
  297. function chiapos {
  298. echo -e "$(tput setaf 10)\nBuild Chia-Pos:$(tput sgr0)"
  299. sleep 1
  300. cd /home/wareck/chia
  301. if [ ! -d /home/wareck/chia/chia-pos ]
  302. then
  303. git clone https://github.com/Chia-Network/chiapos.git chia-pos
  304. cd /home/wareck/chia/chia-pos
  305. else
  306. cd /home/wareck/chia/chia-pos
  307. git pull
  308. fi
  309. if [ ! -d build ]; then mkdir build;fi
  310. cd build
  311. cmake ..
  312. cmake --build . -- -j 6
  313. echo -e "\e[97mDone.\e[0m"
  314. }
  315. function miner_ {
  316. echo -e "$(tput setaf 10)\nChia-Miner (hpool):$(tput sgr0)"
  317. sleep 1
  318. wget -c -q --show-progress http://folivier.homelinux.org/cube/pack/chia-miner.tar.xz -O /home/wareck/Build_Cube/pack/chia-miner.tar.xz
  319. cp /home/wareck/Build_Cube/pack/chia-miner.tar.xz /home/wareck/miners
  320. cd /home/wareck/miners
  321. tar xvfJ chia-miner.tar.xz
  322. rm chia-miner.tar.xz
  323. echo -e "\e[97mDone.\e[0m"
  324. }
  325. function chia_blockchain {
  326. echo -e "$(tput setaf 10)\nBuild Chia-blockchain & Gui :$(tput sgr0)"
  327. sleep 1
  328. if ! [ -d /home/wareck/blockchain ];then mkdir /home/wareck/blockchain;fi
  329. cd /home/wareck/blockchain
  330. if [ ! -d /home/wareck/blockchain/chia-blockchain ]
  331. then
  332. git clone https://github.com/Chia-Network/chia-blockchain.git -b latest --recurse-submodules
  333. cd chia-blockchain
  334. else
  335. cd chia-blockchain
  336. git pull
  337. fi
  338. sh install.sh
  339. source ./activate
  340. sh install-gui.sh
  341. if [ -f /Store/.chia ]
  342. then
  343. ln -s /Store/.chia /home/wareck/.chia
  344. ln -s /Store/.chia_keys /home/wareck/.chia_keys
  345. fi
  346. echo -e "\e[97mDone.\e[0m"
  347. }
  348. function chia_proxy {
  349. echo -e "$(tput setaf 10)\nChia-X-Proxy (Cuda):$(tput sgr0)"
  350. wget -c -q --show-progress http://folivier.homelinux.org/cube/pack/chia-x-proxy.tar.xz -O /home/wareck/Build_Cube/pack/chia-x-proxy.tar.xz
  351. cp /home/wareck/Build_Cube/pack/chia-x-proxy.tar.xz /home/wareck/
  352. cd /home/wareck/chia/
  353. tar xvfJ /home/wareck/chia-x-proxy.tar.xz
  354. rm /home/wareck/chia-x-proxy.tar.xz
  355. sleep 1
  356. cat <<'EOF'>> x-proxy.service
  357. [Unit]
  358. Description=x-proxy
  359. After=network.target
  360. StartLimitIntervalSec=500
  361. StartLimitBurst=5
  362. [Service]
  363. #Restart=on-failure
  364. #RestartSec=5s
  365. WorkingDirectory=/home/wareck/chia/x-proxy/
  366. User=wareck
  367. Group=adm
  368. ExecStart=/usr/bin/screen -DmS x-proxy /home/wareck/chia/x-proxy/x-proxy-v1.9.1 -config /home/wareck/chia/x-proxy/config.yaml
  369. ExecStop=/usr/bin/screen -S x-proxy -X quit
  370. LimitNOFILE=999999
  371. [Install]
  372. WantedBy=multi-user.target
  373. EOF
  374. sudo mv x-proxy.service /etc/systemd/system/x-proxy.service
  375. sudo systemctl daemon-reload
  376. sudo systemctl start x-proxy.service
  377. sudo systemctl enable x-proxy.service
  378. echo -e "\e[97mDone.\e[0m"
  379. }
  380. function service_old {
  381. echo -e "$(tput setaf 10)\nInstall chia-miner service (hpool) :$(tput sgr0)"
  382. sleep 1
  383. echo "Generation du fichier /etc/init.d/chia-miner"
  384. cat <<'EOF'>> chia-miner.sh
  385. #!/bin/sh
  386. ### BEGIN INIT INFO
  387. # Provides: chiaminer
  388. # Required-Start: networking
  389. # Default-Start: 3 4 5
  390. # Default-Stop: 0 6
  391. ### END INIT INFO
  392. case "$1" in
  393. start)
  394. if pgrep -x "hpool-miner-chia" > /dev/null
  395. then
  396. sudo killall -9 hpool-miner-chia | true
  397. fi
  398. su wareck -c "screen -dmS chia-miner /home/wareck/miners/chia-miner/hpool-miner-chia -config /home/wareck/miners/chia-miner/config.yaml"
  399. ;;
  400. stop)
  401. if pgrep -x "hpool-miner-chia" > /dev/null
  402. then
  403. sudo killall -9 hpool-miner-chia | true
  404. fi
  405. ;;
  406. restart)
  407. $0 stop
  408. $0 start
  409. ;;
  410. *)
  411. echo "Usage: /etc/init.d/chia-miner {start|restart|stop}"
  412. exit 1
  413. ;;
  414. esac
  415. exit 0
  416. EOF
  417. chmod +x chia-miner.sh
  418. sudo cp chia-miner.sh /etc/init.d/chia-miner
  419. sudo update-rc.d chia-miner defaults
  420. sleep 1
  421. sudo /etc/init.d/chia-miner start
  422. sudo rm chia-miner.sh
  423. echo -e "\e[97mDone.\e[0m"
  424. }
  425. function service_ {
  426. echo -e "$(tput setaf 10)\nInstall chia-miner service (hpool) :$(tput sgr0)"
  427. sleep 1
  428. cat <<'EOF'>> chia-miner.service
  429. [Unit]
  430. Description=HPool miner
  431. After=network.target
  432. StartLimitIntervalSec=500
  433. StartLimitBurst=5
  434. [Service]
  435. #Restart=on-failure
  436. #RestartSec=5s
  437. WorkingDirectory=/home/wareck/miners/chia-miner/
  438. User=wareck
  439. Group=adm
  440. ExecStart=/usr/bin/screen -DmS hpool-miner /home/wareck/miners/chia-miner/hpool-miner-chia -config /home/wareck/miners/chia-miner/config.yaml
  441. ExecStop=/usr/bin/screen -S hpool-miner -X quit
  442. LimitNOFILE=999999
  443. [Install]
  444. WantedBy=multi-user.target
  445. EOF
  446. sudo mv chia-miner.service /etc/systemd/system/hpool-miner.service
  447. sudo systemctl daemon-reload
  448. sudo systemctl start hpool-miner.service
  449. sudo systemctl enable hpool-miner.service
  450. echo -e "\e[97mDone.\e[0m"
  451. }
  452. function foxypool_ {
  453. echo -e "$(tput setaf 10)\nInstall FoxyPool miner :$(tput sgr0)"
  454. cd /home/wareck/miners
  455. wget -c -q --show-progress http://folivier.homelinux.org/cube/pack/foxypool.tar.xz
  456. tar xfJ foxypool.tar.xz --checkpoint=.100
  457. echo ""
  458. rm foxypool.tar.xz
  459. if [ -f /home/wareck/chia/chia-gigahorse/cuda-plotter/linux/x86_64/foxypool.sh ];then rm /home/wareck/chia/chia-gigahorse/cuda-plotter/linux/x86_64/foxypool.sh;fi
  460. cat <<'EOF'>> foxypool.sh
  461. CTR=xch1f5y47t9jhkthq4fktq5md2d7wz3ruwdsnqah9ym8k3dd0ll2gheqh7l785
  462. FPK=8ba5acd276b45fd0f749ce195dcddcf0e63c3bf2e751e9e273faa0125075c36a11f2ee231e7cf74abed2920be97fc373
  463. OUT=@192.168.1.100
  464. ./cuda_plot_k32 -g 0 -c $CTR -f $FPK -C 17 -n 1 -t /raid/plotting/ -3 /raid/plotting/ -d $OUT
  465. ProofOfSpace farm -t 8 -d 100 -f $OUT
  466. EOF
  467. chmod +x foxypool.sh
  468. mv foxypool.sh /home/wareck/chia/chia-gigahorse/cuda-plotter/linux/x86_64/foxypool.sh
  469. echo -e "$(tput setaf 10)\nInstall FoxyPool service :$(tput sgr0)"
  470. cat > $HOME/foxypool.service << EOF
  471. # The foxypool service (part of systemd)
  472. # file: /etc/systemd/system/foxypool.service
  473. [Unit]
  474. Description = Foxypool Service
  475. After=network.target
  476. [Service]
  477. Type=simple
  478. User = $USER
  479. WorkingDirectory= $HOME/miners/foxypool
  480. ExecStart = $HOME/miners/foxypool/foxy-gh-farmer -c $HOME/miners/foxypool/foxy-gh-farmer.yaml
  481. Restart = on-failure
  482. RestartSec=30
  483. LimitNOFILE=99999
  484. StandardOutput=syslog
  485. StandardError=syslog
  486. SyslogIdentifier=foxypool
  487. [Install]
  488. WantedBy = multi-user.target
  489. EOF
  490. sudo mv $HOME/foxypool.service /etc/systemd/system/foxypool.service >/dev/null
  491. sudo chmod 644 /etc/systemd/system/foxypool.service
  492. cat <<'EOF'>> foxypool.conf
  493. if $programname == 'flexfarmer' then /var/log/foxypool.log
  494. & stop
  495. EOF
  496. sudo cp foxypool.conf /etc/rsyslog.d/foxypool.conf
  497. sudo rm foxypool.conf
  498. if [ ! -f /var/log/foxypool.log ]
  499. then
  500. sudo touch /var/log/foxypool.log
  501. sudo chown syslog:adm /var/log/foxypool.log
  502. fi
  503. cat <<'EOF'>> logrot
  504. /var/log/foxypool.log {
  505. daily
  506. rotate 7
  507. copytruncate
  508. notifempty
  509. missingok
  510. su root syslog
  511. }
  512. EOF
  513. sudo cp logrot /etc/logrotate.d/foxypool
  514. sudo rm logrot
  515. sudo systemctl restart rsyslog >/dev/null 2>&1
  516. sudo systemctl daemon-reload >/dev/null 2>&1
  517. sudo systemctl enable foxypool >/dev/null 2>&1
  518. sudo systemctl start foxypool >/dev/null 2>&1
  519. echo -e "\e[97mDone.\e[0m"
  520. }
  521. function cmake_ {
  522. if [ $BladeBit = "YES" ]
  523. then
  524. pids=""
  525. /home/wareck/Build_Cube/options/tools/_cmake.sh & pids="$pids $!"
  526. wait $pids
  527. fi
  528. }
  529. simplify_config
  530. intro_
  531. update_
  532. cmake_
  533. case $Gui in
  534. ONLY)
  535. chia_blockchain
  536. ;;
  537. *)
  538. if [ $GigaHorse = "YES" ];then gigahorse;fi
  539. if [ $MadMax = "YES" ];then chia_plotter;fi
  540. if [ $BladeBit = "YES" ];then bladebit;fi
  541. if [ $ChiaPos = "YES" ];then chiapos;fi
  542. if [ $H9_Miner = "YES" ];then miner_;fi
  543. if [ $H9_ChiaService = "YES" ];then service_;fi
  544. if [ $H9_ChiaProxy = "YES" ]; then chia_proxy;fi
  545. if [ $FoxyPool = "YES" ]; then foxypool_;fi
  546. if [ $GigaHorse_farmer = "YES" ];then GigaHorse_farmer_;fi
  547. if [ $Gui = "YES" ]; then chia_blockchain;fi
  548. ;;
  549. esac
  550. echo -e "\n\e[97mEnd of process...\e[0m"