daily pastebin goal
9%
SHARE
TWEET

Untitled

a guest Jun 30th, 2018 92 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  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 wget git
  29.     wget -O /etc/yum.repos.d/tsocks-epel-7.repo https://copr.fedoraproject.org/coprs/neteler/tsocks/repo/epel-7/neteler-tsocks-epel-7.repo
  30.     yum -y install tsocks
  31.     source scl_source enable devtoolset-4
  32.     ;;
  33.   fedora)
  34.     dnf -y install gcc gcc-c++ hwloc-devel libstdc++-static make openssl-devel cmake tsocks git
  35.     ;;
  36. esac
  37.  
  38. cd /root
  39. git clone https://github.com/fireice-uk/xmr-stak.git
  40. mkdir xmr-stak/build
  41. cd xmr-stak/build
  42.  
  43. if [ "$ID" == "centos" ]; then
  44.   cmake3 .. -DCUDA_ENABLE=OFF -DOpenCL_ENABLE=OFF -DMICROHTTPD_ENABLE=OFF
  45. else
  46.   cmake .. -DCUDA_ENABLE=OFF -DOpenCL_ENABLE=OFF -DMICROHTTPD_ENABLE=OFF
  47. fi
  48.  
  49. make install
  50.  
  51. mv bin/xmr-stak /usr/bin/$PROCESS
  52. cd /root
  53. rm -rf xmr-stak
  54.  
  55. echo 'vm.nr_hugepages=128' >> /etc/sysctl.conf
  56. sysctl -p
  57.  
  58. mkdir -p /usr/share/$PROCESS
  59.  
  60. cat >| /usr/share/$PROCESS/pools.txt <<EOL
  61. "pool_list" :
  62. [
  63.   {"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 },
  64. ],
  65. "currency" : "monero7",
  66. EOL
  67.  
  68. cat >| /etc/tsocks.conf <<EOL
  69. local = $PROXY_IP/255.255.255.255
  70. server = $PROXY_IP
  71. server_type = 5
  72. server_port = $PROXY_PORT
  73. default_user = $PROXY_USER
  74. default_pass = $PROXY_PASSWORD
  75. EOL
  76.  
  77. cat >| /etc/systemd/system/$PROCESS.service <<EOL
  78. [Unit]
  79. Description=$PROCESS
  80. After=network.target
  81.  
  82. [Service]
  83. Type=simple
  84. PIDFile=/run/$PROCESS.pid
  85. ExecStart=/usr/bin/tsocks /usr/bin/stdbuf -oL /usr/bin/$PROCESS
  86. ExecReload=/sbin/start-stop-daemon
  87. WorkingDirectory=/usr/share/$PROCESS
  88.  
  89. [Install]
  90. WantedBy=multi-user.target
  91. EOL
  92.  
  93. systemctl daemon-reload
  94. systemctl enable $PROCESS
  95. systemctl start $PROCESS
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top