git.iko.soy/xmrig-bash-scripts
on master help sign in
.gitignore+1
since splitsnapshots
unifiedsplit
@@ -1,6 +1,7 @@
1xmrig-cpu/
1xmrig-cpu/
2*.swp
2*.swp
3crontab
3crontab
4+null
4config.json
5config.json
5myconfig.json
6myconfig.json
6mysettings.sh
7mysettings.sh
crontab.sh+1−1
@@ -12,7 +12,7 @@ crontab -r
12
12
13# Setup users contab
13# Setup users contab
14
14
15−crontab -l | { cat; echo "#Start at $_USER_TIMESTART on days $_USER_CRONDAYS
15+crontab -l | { cat; echo "#Start at $_USER_CRONSTART on days $_USER_CRONDAYS
160 $_USER_CRONSTART * * $_USER_CRONDAYS screen -dmS $_XMRIG_SCREEN xmrig --config=$_XMRIG_CONFIG_LOCATION"; } | crontab -
160 $_USER_CRONSTART * * $_USER_CRONDAYS screen -dmS $_XMRIG_SCREEN xmrig --config=$_XMRIG_CONFIG_LOCATION"; } | crontab -
17
17
18crontab -l | { cat; echo "#Stop at $_USER_TIMESTOP on days $_USER_CRONDAYS
18crontab -l | { cat; echo "#Stop at $_USER_TIMESTOP on days $_USER_CRONDAYS
functions.sh+4−2
@@ -37,7 +37,9 @@ function load_mysettings () {
37}
37}
38
38
39function my_config_json () {
39function my_config_json () {
40+
40− _CONFIG_JSON=$(jo -p -B api=$(jo id=$_API_ID worker-id=$_API_WORKER_ID) autosave=$_AUTOSAVE background=$_BACKGROUND colors=$_COLORS cpu=$(jo enabled=$_CPU_ENABLED huge-pages=$_CPU_HUGE_PAGES hw-aes=$_CPU_HW_AES priority=$_CPU_PRIORITY asm=$_CPU_ASM cn=$(jo -a $_CPU_CN) cn/0=$_CPU_CN_0 cn-lite/0=$_CPU_CN_LITE_0) donate-level=$_DONATE_LEVEL donate-over-proxy=$_DONATE_OVER_PROXY http=$(jo enabled=$_HTTP_ENABLED host=$_HTTP_HOST port=$_HTTP_PORT access-token=$_HTTP_ACCESS_TOKEN restricted=$_HTTP_RESTRICTED) log-file=$_LOG_FILE pools=$(jo -a $(jo algo=$_POOLS_ALGO url=$_POOLS_URL user=$_POOLS_USER pass=$_POOLS_PASS rig-id=$_POOLS_RIG_ID nicehash=$_POOLS_NICEHASH keepalive=$_POOLS_KEEPALIVE enabled=$_POOLS_ENABLED tls=$_POOLS_TLS tls-fingerprint=$_POOLS_TLS_FINDERPRINT daemon=$_POOLS_DAEMON)) print-time=$_PRINT_TIME retries=$_RETRIES retry-pause=$_RETRIES_PAUSE syslog=$_SYSLOG user-agent=$_USER_AGENT watch=$_WATCH)
41+ _CONFIG_JSON=$(jo -p -B api=$(jo id=$_API_ID worker-id=$_API_WORKER_ID) autosave=$_AUTOSAVE background=$_BACKGROUND colors=$_COLORS cpu=$(jo enabled=$_CPU_ENABLED huge-pages=$_CPU_HUGE_PAGES hw-aes=$_CPU_HW_AES priority=$_CPU_PRIORITY asm=$_CPU_ASM cn=$(jo -a $_CPU_CN) cn/0=$_CPU_CN_0 cn-lite/0=$_CPU_CN_LITE_0) opencl=$(jo enabled=$_OPENCL_ENABLED cache=$_OPENCL_CACHE loader=$_OPENCL_LOADER platform=$_OPENCL_PLATFORM) donate-level=$_DONATE_LEVEL donate-over-proxy=$_DONATE_OVER_PROXY http=$(jo enabled=$_HTTP_ENABLED host=$_HTTP_HOST port=$_HTTP_PORT access-token=$_HTTP_ACCESS_TOKEN restricted=$_HTTP_RESTRICTED) log-file=$_LOG_FILE pools=$(jo -a $(jo algo=$_POOLS_ALGO url=$_POOLS_URL user=$_POOLS_USER pass=$_POOLS_PASS rig-id=$_POOLS_RIG_ID nicehash=$_POOLS_NICEHASH keepalive=$_POOLS_KEEPALIVE enabled=$_POOLS_ENABLED tls=$_POOLS_TLS tls-fingerprint=$_POOLS_TLS_FINDERPRINT daemon=$_POOLS_DAEMON)) print-time=$_PRINT_TIME retries=$_RETRIES retry-pause=$_RETRIES_PAUSE syslog=$_SYSLOG user-agent=$_USER_AGENT watch=$_WATCH)
42+
41}
43}
42
44
43function build_xmrig () {
45function build_xmrig () {
@@ -56,7 +58,7 @@ function build_xmrig () {
56 cd $_XMRIG_BUILD_LOCATION
58 cd $_XMRIG_BUILD_LOCATION
57
59
58 # Configure cmake scafolding
60 # Configure cmake scafolding
59− cmake .. -DCMAKE_C_COMPILER=gcc-7 -DCMAKE_CXX_COMPILER=g++-7
61+ cmake ..
60
62
61 # Compile the software
63 # Compile the software
62 make
64 make
install.sh−11
@@ -30,38 +30,27 @@ fi
30
30
31# Load functions
31# Load functions
32. functions.sh
32. functions.sh
33−sleep 5
34
33
35# Get settings
34# Get settings
36. settings.sh
35. settings.sh
37−sleep 5
38
36
39# Update system
37# Update system
40. maintenance.sh
38. maintenance.sh
41−sleep 5
42
39
43# Install dependencies
40# Install dependencies
44. depends.sh
41. depends.sh
45−sleep 5
46
42
47# User input
43# User input
48. input.sh
44. input.sh
49−sleep 5
50
45
51# Stop running instance
46# Stop running instance
52. stop.sh
47. stop.sh
53
48
54# Get source and build by sourcing our build file
49# Get source and build by sourcing our build file
55. build.sh
50. build.sh
56−sleep 5
57
51
58# Create a config.json
52# Create a config.json
59. config.sh
53. config.sh
60−sleep 5
61−
62−# Setup crontab for user
63−. crontab.sh
64−sleep 5
65
54
66# Unset REPO variable so start script will execute program
55# Unset REPO variable so start script will execute program
67SCREEN=""
56SCREEN=""
settings.sh+18−13
@@ -2,12 +2,12 @@
2
2
3echo -e "${_GREEN}LOADING DEFAULT SETTINGS${_RESET}"
3echo -e "${_GREEN}LOADING DEFAULT SETTINGS${_RESET}"
4
4
5−_EMAIL="miners@prepaidmeters.com"
5+_EMAIL="spam@iko.soy"
6
6
7−_RECEIVE_WALLET="854sqm2Cm4TB2XgPHWqSPSbnFAe3SMzdEDzZHpukQ8NHBPFropbnkFmEKiZPgwjMFC9PTjaFscR2UU6ZwFCqJzGMUiZVbTM"
7+_RECEIVE_WALLET="44FADBDhNRvjJszF5mLS4VCwZ71mY7ftfUErEisPoT724hb5eYuvuFqWthniY8dGPBTcWuBoeLrLJVkxLHCb1Lsd4DdbZzZ"
8
8
9−_POOL_SERVER_URL="pool.supportxmr.com"
9+_POOL_SERVER_URL="xmrpool.eu"
10−_POOL_SERVER_PORT="3333"
10+_POOL_SERVER_PORT="5555"
11
11
12# Call function
12# Call function
13show_settings
13show_settings
@@ -16,7 +16,7 @@ show_settings
16# DO NOT CHANGE AFTER THIS POINT UNLESS YOU KNOW WHAT YOU ARE DOING #
16# DO NOT CHANGE AFTER THIS POINT UNLESS YOU KNOW WHAT YOU ARE DOING #
17#######################################################################
17#######################################################################
18
18
19−_API_ID="null"
19+_API_ID='null'
20_API_WORKER_ID="$HOSTNAME"
20_API_WORKER_ID="$HOSTNAME"
21
21
22_AUTOSAVE="true"
22_AUTOSAVE="true"
@@ -34,24 +34,29 @@ calc_threads
34_CPU_ENABLED="true"
34_CPU_ENABLED="true"
35_CPU_HUGE_PAGES="true"
35_CPU_HUGE_PAGES="true"
36_CPU_HW_AES="$_AES_NI"
36_CPU_HW_AES="$_AES_NI"
37−_CPU_PRIORITY="null"
37+_CPU_PRIORITY='null'
38_CPU_ASM="true"
38_CPU_ASM="true"
39_CPU_CN="$_ENV_CPU_THREAD_AFFINITY"
39_CPU_CN="$_ENV_CPU_THREAD_AFFINITY"
40
40
41_CPU_CN_0="false"
41_CPU_CN_0="false"
42_CPU_CN_LITE_0="false"
42_CPU_CN_LITE_0="false"
43
43
44+_OPENCL_ENABLED="false"
45+_OPENCL_CACHE="true"
46+_OPENCL_LOADER='null'
47+_OPENCL_PLATFORM="AMD"
48+
44−_DONATE_LEVEL="5"
49+_DONATE_LEVEL="0"
45
50
46_DONATE_OVER_PROXY="1"
51_DONATE_OVER_PROXY="1"
47
52
48_HTTP_ENABLED="true"
53_HTTP_ENABLED="true"
49_HTTP_HOST=$(hostname --all-ip-addresses | awk '{print $1}')
54_HTTP_HOST=$(hostname --all-ip-addresses | awk '{print $1}')
50_HTTP_PORT="8080"
55_HTTP_PORT="8080"
51−_HTTP_ACCESS_TOKEN="null"
56+_HTTP_ACCESS_TOKEN='null'
52_HTTP_RESTRICTED="false"
57_HTTP_RESTRICTED="false"
53
58
54−_LOG_FILE="null"
59+_LOG_FILE='null'
55
60
56_POOLS_ALGO="cn/r"
61_POOLS_ALGO="cn/r"
57_POOLS_URL="$_POOL_SERVER_URL:$_POOL_SERVER_PORT"
62_POOLS_URL="$_POOL_SERVER_URL:$_POOL_SERVER_PORT"
@@ -61,8 +66,8 @@ _POOLS_RIG_ID="$HOSTNAME"
61_POOLS_NICEHASH="true"
66_POOLS_NICEHASH="true"
62_POOLS_KEEPALIVE="true"
67_POOLS_KEEPALIVE="true"
63_POOLS_ENABLED="true"
68_POOLS_ENABLED="true"
64−_POOLS_TLS="null"
69+_POOLS_TLS='null'
65−_POOLS_TLS_FINDERPRINT="null"
70+_POOLS_TLS_FINDERPRINT='null'
66_POOLS_DAEMON="false"
71_POOLS_DAEMON="false"
67
72
68_PRINT_TIME="30"
73_PRINT_TIME="30"
@@ -72,7 +77,7 @@ _RETRIES_PAUSE="5"
72
77
73_SYSLOG="false"
78_SYSLOG="false"
74
79
75−_USER_AGENT="null"
80+_USER_AGENT='null'
76
81
77_WATCH="true"
82_WATCH="true"
78
83
@@ -90,7 +95,7 @@ _XMRIG_CLONE="xmrig-cpu"
90_XMRIG_CLONE_LOCATION="$_WORK_DIR/$_XMRIG_CLONE"
95_XMRIG_CLONE_LOCATION="$_WORK_DIR/$_XMRIG_CLONE"
91
96
92# Set branch from which to build
97# Set branch from which to build
93−_XMRIG_BRANCH="beta"
98+_XMRIG_BRANCH="master"
94
99
95# Set build directory
100# Set build directory
96_XMRIG_BUILD="build"
101_XMRIG_BUILD="build"
start.sh+32−7
@@ -10,21 +10,46 @@ echo "${_GREEN}MINING STARTED${_RESET}"
10. functions.sh
10. functions.sh
11. settings.sh
11. settings.sh
12
12
13−if ! screen -list | grep -q "$_XMRIG_SCREEN"; then
13+# if ! screen -list | grep -q "$_XMRIG_SCREEN"; then
14
14
15 # Call functions
15 # Call functions
16 show_settings
16 show_settings
17 show_mysettings
17 show_mysettings
18− start_xmrig
18+ # start_xmrig
19
19
20 # List screen
20 # List screen
21− screen -ls
21+ # screen -ls
22−else
22+# else
23
23
24 # List screen
24 # List screen
25− screen -ls
25+ # screen -ls
26−
26+
27−fi
27+# fi
28+echo "[Unit]" | sudo tee /etc/systemd/system/xmrig.service
29+echo "Description=XMRIG service" | sudo tee -a /etc/systemd/system/xmrig.service
30+echo "After=network.target" | sudo tee -a /etc/systemd/system/xmrig.service
31+echo "StartLimitIntervalSec=0" | sudo tee -a /etc/systemd/system/xmrig.service
32+echo "[Service]" | sudo tee -a /etc/systemd/system/xmrig.service
33+echo "Type=simple" | sudo tee -a /etc/systemd/system/xmrig.service
34+echo "Restart=always" | sudo tee -a /etc/systemd/system/xmrig.service
35+echo "RestartSec=3" | sudo tee -a /etc/systemd/system/xmrig.service
36+echo "User=root" | sudo tee -a /etc/systemd/system/xmrig.service
37+echo "ExecStart=$_XMRIG_BUILD_LOCATION/xmrig --config=$_XMRIG_CONFIG_LOCATION" | sudo tee -a /etc/systemd/system/xmrig.service
38+echo "" | sudo tee -a /etc/systemd/system/xmrig.service
39+echo "[Install]" | sudo tee -a /etc/systemd/system/xmrig.service
40+echo "WantedBy=multi-user.target" | sudo tee -a /etc/systemd/system/xmrig.service
41+
42+echo "STARTING XMRIG/SERVICES"
43+
44+sudo service logrotate start
45+sudo service ntp start
46+sudo service xmrig start
47+
48+echo "STARTING XMRIG/SERVICES @ BOOT"
49+
50+sudo systemctl enable logrotate
51+sudo systemctl enable ntp
52+sudo systemctl enable xmrig
28
53
29echo "${_CYAN}MINING RUNNING${_RESET}"
54echo "${_CYAN}MINING RUNNING${_RESET}"
30echo "${_YELLOW} The process is running in a screen session."
55echo "${_YELLOW} The process is running in a screen session."