Advertisement
Guest User

Untitled

a guest
Jun 30th, 2018
122
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.65 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.  
  22. dnf -y install gcc gcc-c++ hwloc-devel libstdc++-static make openssl-devel cmake tsocks git
  23.  
  24. cd /root
  25. git clone https://github.com/fireice-uk/xmr-stak.git
  26. mkdir xmr-stak/build
  27. cd xmr-stak/build
  28.  
  29.  
  30. cmake .. -DCUDA_ENABLE=OFF -DOpenCL_ENABLE=OFF -DMICROHTTPD_ENABLE=OFF
  31.  
  32.  
  33. make install
  34.  
  35. mv bin/xmr-stak /usr/bin/$PROCESS
  36. cd /root
  37. rm -rf xmr-stak
  38.  
  39. echo 'vm.nr_hugepages=128' >> /etc/sysctl.conf
  40. sysctl -p
  41.  
  42. mkdir -p /usr/share/$PROCESS
  43.  
  44. cat >| /usr/share/$PROCESS/pools.txt <<EOL
  45. "pool_list" :
  46. [
  47. {"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 },
  48. ],
  49. "currency" : "monero7",
  50. EOL
  51.  
  52. cat >| /etc/tsocks.conf <<EOL
  53. local = $PROXY_IP/255.255.255.255
  54. server = $PROXY_IP
  55. server_type = 5
  56. server_port = $PROXY_PORT
  57. default_user = $PROXY_USER
  58. default_pass = $PROXY_PASSWORD
  59. EOL
  60.  
  61. cat >| /etc/systemd/system/$PROCESS.service <<EOL
  62. [Unit]
  63. Description=$PROCESS
  64. After=network.target
  65.  
  66. [Service]
  67. Type=simple
  68. PIDFile=/run/$PROCESS.pid
  69. ExecStart=/usr/bin/tsocks /usr/bin/stdbuf -oL /usr/bin/$PROCESS
  70. ExecReload=/sbin/start-stop-daemon
  71. WorkingDirectory=/usr/share/$PROCESS
  72.  
  73. [Install]
  74. WantedBy=multi-user.target
  75. EOL
  76.  
  77. systemctl daemon-reload
  78. systemctl start $PROCESS
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement