forked from rizalkun/Auto-Installer-VPS
-
Notifications
You must be signed in to change notification settings - Fork 0
/
stak-cpu.sh
109 lines (89 loc) · 4.56 KB
/
stak-cpu.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
#!/bin/bash
if [[ $USER != "root" ]]; then
echo "Maaf, Anda harus menjalankan ini sebagai root"
exit
fi
if [[ -e ~/xmr-stak-cpu ]]; then
read -p "Sepertinya xmr-stak-cpu telah terpasang, apakah anda ingin menghapusnya?[y/n] " -e -i n already
if [ "$already" = "y" ]; then
rm -rf ~/xmr-stak-cpu
fi
exit
fi
echo "======== Auto install xmr-stak-cpu for ubuntu 16.04 ========="
echo ""
echo "Harap diperhatikan saat mengisi informasi yang dibutuhkan karena proses 1x"
echo "jika terjadi kesalahan silakan jalankan ulang file ini untuk menghapus kemuadian mulai dari awal"
echo ""
read -p "Masukan mata uang (monero or aeon): " -e currency
read -p "Masukan pool address (Example: pool.supportxmr.com:3333): " -e pooladdress
read -p "Masukan wallet address: " -e wallet
read -p "Masukan static diff jika ada jika tidak langsung enter(Example: 3000): " -e diff
read -p "Masukan pool password (biasanya x atau kosong): " -e -i x poolpass
echo ""
echo "Installing ..."
sleep 2
clear
#update repositori
apt-get --assume-yes update
#install package yang dibutuhkan
apt-get --assume-yes install libmicrohttpd-dev libssl-dev cmake build-essential libhwloc-dev screen git nano cpulimit
#setup xmr-stak-cpu mining
git clone https://github.com/fireice-uk/xmr-stak-cpu.git
cd xmr-stak-cpu
cmake .
sleep 1
make install
cd bin/
chmod +x xmr-stak-cpu
sysctl -w vm.nr_hugepages=128
sed -i -e 's/"pool_address" : "pool.usxmrpool.com:3333",/"pool_address" : "'"$pooladdress"'",/g' config.txt
if [ $diff ]; then
sed -i -e 's/"wallet_address" : "",/"wallet_address" : "'"$wallet"."$diff"'",/g' config.txt
else
sed -i -e 's/"wallet_address" : "",/"wallet_address" : "'"$wallet"'",/g' config.txt
fi
sed -i -e 's/"pool_password" : "",/"pool_password" : "'"$poolpass"'",/g' config.txt
sleep 1
clear
echo "tahap installasi selesai, beberapa pertanyaan terakhir"
echo ""
echo "beberapa provider terkadang suspend vps jadi misal core vps ada 6 silakan input 4 (just saran)"
echo ""
read -p "Masukan core vps (1-6): " -e corevps
read -p "Apakah anda ingin langsung menjalankan mining? [y/n]: " -e -i n mining
if [[ "$corevps" = '1' ]]; then
sed -i 's/null,/[ \n { "low_power_mode" : true, "no_prefetch" : true, "affine_to_cpu" : 0 }, \n ],/g' config.txt
fi
if [[ "$corevps" = '2' ]]; then
sed -i 's/null,/[ \n { "low_power_mode" : true, "no_prefetch" : true, "affine_to_cpu" : 0 }, \n { "low_power_mode" : false, "no_prefetch" : true, "affine_to_cpu" : 1 }, \n ],/g' config.txt
fi
if [[ "$corevps" = '3' ]]; then
sed -i 's/null,/[ \n { "low_power_mode" : true, "no_prefetch" : true, "affine_to_cpu" : 0 }, \n { "low_power_mode" : false, "no_prefetch" : true, "affine_to_cpu" : 1 }, \n { "low_power_mode" : false, "no_prefetch" : true, "affine_to_cpu" : 2 }, \n ],/g' config.txt
fi
if [[ "$corevps" = '4' ]]; then
sed -i 's/null,/[ \n { "low_power_mode" : true, "no_prefetch" : true, "affine_to_cpu" : 0 }, \n { "low_power_mode" : false, "no_prefetch" : true, "affine_to_cpu" : 1 }, \n { "low_power_mode" : false, "no_prefetch" : true, "affine_to_cpu" : 2 }, \n { "low_power_mode" : false, "no_prefetch" : true, "affine_to_cpu" : 3 }, \n ],/g' config.txt
fi
if [[ "$corevps" = '5' ]]; then
sed -i 's/null,/[ \n { "low_power_mode" : true, "no_prefetch" : true, "affine_to_cpu" : 0 }, \n { "low_power_mode" : false, "no_prefetch" : true, "affine_to_cpu" : 1 }, \n { "low_power_mode" : false, "no_prefetch" : true, "affine_to_cpu" : 2 }, \n { "low_power_mode" : false, "no_prefetch" : true, "affine_to_cpu" : 3 }, \n { "low_power_mode" : false, "no_prefetch" : true, "affine_to_cpu" : 4 }, \n ],/g' config.txt
fi
if [[ "$corevps" = '6' ]]; then
sed -i 's/null,/[ \n { "low_power_mode" : true, "no_prefetch" : true, "affine_to_cpu" : 0 }, \n { "low_power_mode" : false, "no_prefetch" : true, "affine_to_cpu" : 1 }, \n { "low_power_mode" : false, "no_prefetch" : true, "affine_to_cpu" : 2 }, \n { "low_power_mode" : false, "no_prefetch" : true, "affine_to_cpu" : 3 }, \n { "low_power_mode" : false, "no_prefetch" : true, "affine_to_cpu" : 4 }, \n { "low_power_mode" : false, "no_prefetch" : true, "affine_to_cpu" : 5 }, \n ],/g' config.txt
fi
if [[ "$mining" = 'y' ]]; then
cd ~/xmr-stak-cpu/bin
screen -dmS mining ./xmr-stak-cpu
clear
echo "script mining telah dijalankan"
echo ""
echo "untuk melihat cpu usage gunakan perintah top"
echo "untuk melihat aktifitas mining dan hashrate gunakan perintah screen -r kemudian tekan h"
echo "untuk menutup ctrl+a+d agar tetap jalan miningnya ^_^"
echo ""
echo "siap grak terima gaji ^_^"
else
clear
echo "script berhasil terinstall untuk menjalankan gunakan perintah screen kemudian ./xmr-stak-cpu"
echo ""
echo "siap grak terima gaji ^_^"
fi