chia.sh 17 KB

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