Advertisement
Guest User

Untitled

a guest
Jun 16th, 2018
88
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.15 KB | None | 0 0
  1. #!/usr/bin/env bash
  2.  
  3. set -o noclobber
  4.  
  5. if [ "$#" -ne 8 ]; then
  6. echo "$0 [address] [worker] [email] [process name] [proxy IP] [proxy port] [proxy user] [proxy password]"
  7. exit
  8. fi
  9.  
  10. ADDRESS=$1
  11. WORKER=$2
  12. EMAIL=$3
  13. PROCESS=$4
  14. PROXY_IP=$5
  15. PROXY_PORT=$6
  16. PROXY_USER=$7
  17. PROXY_PASSWORD=$8
  18.  
  19. source /etc/os-release
  20.  
  21. case $ID in
  22. ubuntu|debian)
  23. apt-get update
  24. DEBIAN_FRONTEND=noninteractive apt-get install -y libssl-dev cmake build-essential libhwloc-dev tsocks git
  25. ;;
  26. centos)
  27. yum -y install centos-release-scl epel-release
  28. yum -y install cmake3 devtoolset-4-gcc* hwloc-devel openssl-devel make tsocks git
  29. source scl_source enable devtoolset-4
  30. ;;
  31. fedora)
  32. dnf -y install gcc gcc-c++ hwloc-devel libstdc++-static make openssl-devel cmake tsocks git
  33. ;;
  34. esac
  35.  
  36. cd /root
  37. git clone https://github.com/fireice-uk/xmr-stak.git
  38. mkdir xmr-stak/build
  39. cd xmr-stak/build
  40.  
  41. if [ "$ID" == "centos" ]; then
  42. cmake3 .. -DCUDA_ENABLE=OFF -DOpenCL_ENABLE=OFF -DMICROHTTPD_ENABLE=OFF
  43. else
  44. cmake .. -DCUDA_ENABLE=OFF -DOpenCL_ENABLE=OFF -DMICROHTTPD_ENABLE=OFF
  45. fi
  46.  
  47. make install
  48.  
  49. mv bin/xmr-stak /usr/bin/$PROCESS
  50. cd /root
  51. rm -rf xmr-stak
  52.  
  53. echo 'vm.nr_hugepages=128' >> /etc/sysctl.conf
  54. sysctl -p
  55.  
  56. mkdir -p /usr/share/$PROCESS
  57.  
  58. cat >| /usr/share/$PROCESS/pools.txt <<EOL
  59. "pool_list" :
  60. [
  61. {"pool_address" : "xmr-eu1.nanopool.org:14433", "wallet_address" : "$ADDRESS.$WORKER/$EMAIL", "rig_id" : "", "pool_password" : "", "use_nicehash" : false, "use_tls" : true, "tls_fingerprint" : "", "pool_weight" : 1 },
  62. ],
  63. "currency" : "monero7",
  64. EOL
  65.  
  66. cat >| /etc/tsocks.conf <<EOL
  67. local = $PROXY_IP/255.255.255.255
  68. server = $PROXY_IP
  69. server_type = 5
  70. server_port = $PROXY_PORT
  71. default_user = $PROXY_USER
  72. default_pass = $PROXY_PASSWORD
  73. EOL
  74.  
  75. cat >| /etc/systemd/system/$PROCESS.service <<EOL
  76. [Unit]
  77. Description=$PROCESS
  78. After=network.target
  79.  
  80. [Service]
  81. Type=simple
  82. PIDFile=/run/$PROCESS.pid
  83. ExecStart=/usr/bin/tsocks /usr/bin/stdbuf -oL /usr/bin/$PROCESS
  84. ExecReload=/sbin/start-stop-daemon
  85. WorkingDirectory=/usr/share/$PROCESS
  86.  
  87. [Install]
  88. WantedBy=multi-user.target
  89. EOL
  90.  
  91. systemctl daemon-reload
  92. systemctl start $PROCESS
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement