git.iko.soy/xmrig-bash-scripts
on fb5f3cc help sign in
16 files changed+117−193
since splitsnapshots
unifiedsplit
.gitignore−1 README.md+17−18 build.sh+1−3 config.sh+1−3 crontab-off.sh+1−3 crontab-on.sh+1−3 crontab.sh+2−5 depends.sh+2−4 functions.sh+8−27 input.sh+29−30 install.sh+17−19 maintenance.sh+2−4 settings.sh+25−26 start.sh+9−41 stop.sh+1−3 update.sh+1−3
.gitignore−1
@@ -1,7 +1,6 @@
11xmrig-cpu/
22*.swp
33crontab
4−null
54config.json
65myconfig.json
76mysettings.sh
README.md+17−18
@@ -11,7 +11,6 @@ A set of convenience scripts, written in bash, to help manage installation, conf
1111There is allot to install so the install script will do most of the heavy lifting.
1212At the start the expectation is that you have:
1313* Computer running Ubuntu 18.04 (LTS)
14−* Bash shell
1514* User account with sudo privileges
1615* Installed git
1716* Optionally installed [xmrig-proxy](https://github.com/xmrig/xmrig-proxy)
@@ -22,37 +21,38 @@ Some knowledge of:
2221* Linux Command Line Interface
2322* Linux shell `bash`
2423
24+There is more to install but the install script will install the rest.
25+
2526### Installation
2627
27281. Change to your user home directory.
2829 `cd ~`
29−1. Install git.
30+
31+2. Install git.
3032 `sudo apt install git`
31−1. Clone this project.
33+
34+3. Clone this project.
3235 `git clone https://github.com/seanwhe/xmrig-bash-scripts`
33−1. Change into the cloned directory.
36+
37+4. Change into the cloned directory.
3438 `cd xmrig-bash-scripts`
35−1. Run the install script
39+
40+5. Edit the settings file to your preference.
41+ `vim settings.sh`
42+
43+6. Run the install script
3644 `./install.sh`
37−1. When prompted: "Enter your own settings?" enter 'y'es.
38−1. Enter values for your:
39− 1. Pool server URL
40− 1. Pool server TCP port
41− 1. Receive wallet address
42− 1. Email address
43− 1. Miner identifier name
44−1. After install is complete. Attach to the screen session created during the installation.
45+
46+7. After install is complete. Attach to the screen session created during the installation.
4547 `screen -r`
4648
4749### Operation
4850
4951Defaults - The settings.sh contains a number of variables. With the exception of the 'xmrig' binary, which is installed to `/usr/bin/xmrig`, all files remain in the cloned project directory `~/xmrig-bash-scripts`. Any files generated while running the scripts are also created in this directory.
5052
51−During install the folder source for [xmrig cpu](https://github.com/xmrig/xmrig) is cloned to `~/xmrig-bash-scripts/xmrig-cpu/`. The file `config.json`, used to configure xmrig, is also created in this path and is passed to xmrig at startup.
52−
53−During installation it is recomended to enter your own settings. This creates a file named 'mysettings.sh' which will not be overwritten during future installs or upgrades. Values for variables found in 'mysettings.sh' are used to create 'config.json'.
53+During install the folder source for [xmrig cpu](https://github.com/xmrig/xmrig) is cloned to `~/xmrig-bash-scripts/xmrig-cpu/`. The `config.json` is also created in this path.
5454
55−This should work out the box, if you follow the installation steps and enter your own values for 'mysettings.sh.
55+This should work out the box, if you edit only the top section of `settings.sh` and followed the steps here.
5656
5757Once you have a running xmrig then you can start playing around and tweaking to suite requirements.
5858
@@ -67,7 +67,6 @@ The scripts are designed to be modular to promote resuse, execute exclusion and
6767* crontab-on.sh - redefines the users crontab as created during install.
6868* depends.sh - installs dependancies required by xmrig and these scripts.
6969* functions.sh - a collection of functions used in various of the scripts.
70−* input.sh - prompts to enter values for creating 'mysettings.sh'
7170* install.sh - the main entry point when first installing.
7271* maintenance.sh - performs apt update, upgrade, autoremove and autoclean operations.
7372* settings.sh - contains variables used by these scripts.
build.sh+1−3
@@ -1,7 +1,5 @@
11#!/bin/bash
22
3−echo "${_GREEN}BUILD STARTED${_RESET}"
4−
53# Clone source
64if [ -d "$_XMRIG_CLONE_LOCATION" ]; then
75
@@ -47,5 +45,5 @@ sudo cp $_XMRIG_BUILD_LOCATION/xmrig $_XMRIG_TARGET_LOCATION
4745
4846cd $_WORK_DIR
4947
50−echo "${_CYAN}BUILD STOPPED${_RESET}"
48+echo "${_GREEN}BUILD COMPLETE${_RESET}"
5149
config.sh+1−3
@@ -1,8 +1,6 @@
11#!/bin/bash
22
3−echo "${_GREEN}CONFIG STARTED${_RESET}"
4−
53echo "$_CONFIG_JSON" | tee config.json
64
7−echo "${_CYAN}CONFIG STOPPED${_RESET}"
5+echo "${_GREEN}CONFIG CREATED${_RESET}"
86
crontab-off.sh+1−3
@@ -1,7 +1,5 @@
11#!/bin/bash
22
3−echo "${_GREEN}DISABLE CRONTAB STARTED${_RESET}"
4−
53# Removes a user crontab
64# Used in conjunction with crontab-on.sh to toggle user crontab between states:
75# on - start/stop xmrig at specified times
@@ -14,5 +12,5 @@ crontab -l > crontab
1412echo "Removing exiting crontab"
1513crontab -r
1614
17−echo "${_CYAN}DISABLE CRONTAB STOPPED${_RESET}"
15+echo "${_GREEN}CRONTAB DISABLED${_RESET}"
1816
crontab-on.sh+1−3
@@ -1,7 +1,5 @@
11#!/bin/bash
22
3−echo "${_GREEN}ENABLE CRONTAB STARTED${_RESET}"
4−
53# Defines a user crontab with schedules as defined in settings.sh
64# Used in conjunction with crontab-off.sh to toggle user crontab between states:
75# on - start/stop xmrig at specified times
@@ -16,5 +14,5 @@ sleep 5
1614. crontab.sh
1715sleep 5
1816
19−echo "${_CYAN}ENABLE CRONTAB STOPPED${_RESET}"
17+echo "${_GREEN}CRONTAB ENABLED${_RESET}"
2018
crontab.sh+2−5
@@ -1,8 +1,5 @@
11#!/bin/bash
22
3−
4−echo "${_GREEN}CRONTAB STARTED${_RESET}"
5−
63# Set values in settings script
74
85# Remove existing crontab
@@ -12,11 +9,11 @@ crontab -r
129
1310# Setup users contab
1411
15−crontab -l | { cat; echo "#Start at $_USER_CRONSTART on days $_USER_CRONDAYS
12+crontab -l | { cat; echo "#Start at $_USER_TIMESTART on days $_USER_CRONDAYS
16130 $_USER_CRONSTART * * $_USER_CRONDAYS screen -dmS $_XMRIG_SCREEN xmrig --config=$_XMRIG_CONFIG_LOCATION"; } | crontab -
1714
1815crontab -l | { cat; echo "#Stop at $_USER_TIMESTOP on days $_USER_CRONDAYS
19160 $_USER_CRONSTOP * * $_USER_CRONDAYS screen -S $_XMRIG_SCREEN -X kill"; } | crontab -
2017
21−echo "${_CYAN}CRONTAB STOPPED${_RESET}"
18+echo "${_GREEN}CRONTAB CREATED${_RESET}"
2219
depends.sh+2−4
@@ -2,9 +2,7 @@
22
33# Install the software requirements
44
5−echo "${_GREEN}INSTALL DEPENDS STARTED${_RESET}"
6−
7−if [ "$_APT_DEPENDS" -eq "1" ]; then
5+if [ $_APT_DEPENDS = 1 ]; then
86
97 # Install xmrig depends
108 sudo apt install -y software-properties-common git build-essential cmake libuv1-dev libssl-dev libmicrohttpd-dev libhwloc-dev gcc g++
@@ -14,4 +12,4 @@ if [ "$_APT_DEPENDS" -eq "1" ]; then
1412
1513fi
1614
17−echo "${_CYAN}INSTALL DEPENDS STOPPED${_RESET}"
15+echo "${_GREEN}DEPENDENCIES INSTALLED${_RESET}"
functions.sh+8−27
@@ -1,7 +1,5 @@
11#!/bin/bash
22
3−echo -e "${_GREEN}LOADING FUNCTIONS${_RESET}"
4−
53function prompt_confirm() {
64 while true; do
75 read -r -n 1 -p "${1:-Continue?} [y/n]: " REPLY
@@ -13,35 +11,18 @@ function prompt_confirm() {
1311 done
1412}
1513
16−function show_settings () {
17− echo "${_CYAN}Settings from loaded environment:${_RESET}"
18− echo "${_GREEN}Pool URL:${_RESET}: $_POOLS_URL"
19− echo "${_GREEN}Recieve Wallet:${_RESET}: $_POOLS_USER"
20− echo "${_GREEN}Email Address:${_RESET}: $_POOLS_PASS"
21−}
22−
2314function show_mysettings () {
24− if [ -f $_WORK_DIR/$_MYSETTINGS_FILE ]; then
25− load_mysettings
26− echo "${_CYAN}Settings from mysettings.sh:${_RESET}"
27− echo "${_GREEN}Pool URL:${_RESET}: $_POOLS_URL"
28− echo "${_GREEN}Recieve Wallet:${_RESET}: $_POOLS_USER"
29− echo "${_GREEN}Email Address:${_RESET}: $_POOLS_PASS"
30− fi
31−}
32−
33−function load_mysettings () {
3415 if [ -f $_WORK_DIR/$_MYSETTINGS_FILE ]; then
3516 . $_MYSETTINGS_FILE
17+ echo "${_GREEN}Settings from loaded from mysettings.sh.${_RESET}"
18+ echo "${_GREEN}Pool URL:${_RESET}: $_POOL_SERVER_URL"
19+ echo "${_GREEN}Pool Port:${_RESET}: $_POOL_SERVER_PORT"
20+ echo "${_GREEN}Recieve Wallet:${_RESET}: $_RECEIVE_WALLET"
21+ echo "${_GREEN}Email Address:${_RESET}: $_EMAIL"
22+ echo "${_GREEN}Worker Identity:${_RESET}: $_API_WORKER_ID"
3623 fi
3724}
3825
39−function my_config_json () {
40−
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−
43−}
44−
4526function build_xmrig () {
4627 if [ -d $_XMRIG_BUILD_LOCATION ]; then
4728 # Remove existing build directory
@@ -58,7 +39,7 @@ function build_xmrig () {
5839 cd $_XMRIG_BUILD_LOCATION
5940
6041 # Configure cmake scafolding
61− cmake ..
42+ cmake .. -DCMAKE_C_COMPILER=gcc-7 -DCMAKE_CXX_COMPILER=g++-7
6243
6344 # Compile the software
6445 make
@@ -122,4 +103,4 @@ function calc_hugepages () {
122103
123104}
124105
125−echo -e "${_CYAN}FUNCTIONS LOADED${_RESET}"
106+echo -e "${_GREEN}FUNCTIONS LOADED${_RESET}"
input.sh+29−30
@@ -2,27 +2,23 @@
22
33# Ask user questions
44# Capture input
5−# if setting already exist use existing
5+. functions.sh
6+. settings.sh
67
7−echo -e "${_GREEN}USER SETTINGS STARTED${_RESET}"
8+echo -e "${_YELLOW}Choose to use default settings or enter your own.\n"
89
9−if [ -f $_WORK_DIR/$_MYSETTINGS_FILE ]; then
10+echo -e "Use defaults and values will be taken from 'settings.sh'."
11+echo -e "Enter your own and settings will persist to 'mysettings.sh'.\n"
1012
11− # Call function
13+echo -e "Preference is given to settings in 'mysettings.sh'."
14+echo -e "When starting from 'start.sh' and 'mysettings.sh' exists it will be loaded instead of 'settings.sh'.${_RESET}\n"
1215
13− load_mysettings
16+if [ -f $_WORK_DIR/$_MYSETTINGS_FILE ]; then
1417
15− my_config_json
18+ # Call function
19+ show_mysettings
1620
1721else
18− echo -e " ${_YELLOW}Opt for default settings or enter your own.\n"
19−
20− echo -e " No - 'config.json' created with values from 'settings.sh'."
21− echo -e " Yes - 'config.json' created with values from 'mysettings.sh' (recomended).\n"
22−
23− echo -e " When 'mysettings.sh' exists this prompt will be skipped at furture installation."
24− echo -e " Own settings is recomended to avoid your settings being overidden in upgrades.${_RESET}\n"
25−
2622
2723 prompt_confirm "Enter your own settings?"
2824
@@ -36,26 +32,29 @@ else
3632
3733 # Prompt user input
3834
39− echo "Current pool URL: $_POOLS_URL"
40− read -p "Enter new pool URL: " _POOLS_URL
41− echo "_POOLS_URL=\"$_POOLS_URL\"" >> $_MYSETTINGS_FILE_LOCATION
35+ echo "Current pool URL: $_POOL_SERVER_URL"
36+ read -p "Enter new pool URL: " _POOL_SERVER_URL
4237
43− echo "Current Receive Wallet address: $_POOLS_USER"
44− read -p "Enter new Receive Wallet address: " _POOLS_USER
45− echo "_POOLS_USER=\"$_POOLS_USER\"" >> $_MYSETTINGS_FILE_LOCATION
38+ echo "Current pool TCP Port: $_POOL_SERVER_PORT"
39+ read -p "Enter new pool TCP Port: " _POOL_SERVER_PORT
4640
47− echo "Current email address: $_POOLS_PASS"
48− read -p "Enter new email address: " _POOLS_PASS
49− echo "_POOLS_PASS=\"$_POOLS_PASS\"" >> $_MYSETTINGS_FILE_LOCATION
41+ echo "Current Receive Wallet address: $_RECEIVE_WALLET"
42+ read -p "Enter new Receive Wallet address: " _RECEIVE_WALLET
5043
51− fi
52−
53− # Call function
44+ echo "Current email address: $_EMAIL"
45+ read -p "Enter new email address: " _EMAIL
5446
55− load_mysettings
47+ echo "Current Miner Identifier: $_API_WORKER_ID"
48+ read -p "Enter Miner Identifier: " _API_WORKER_ID
5649
57− my_config_json
50+ # Write user input to file
5851
59−fi
52+ echo "_POOL_SERVER_URL=\"$_POOL_SERVER_URL\"" >> $_MYSETTINGS_FILE_LOCATION
53+ echo "_POOL_SERVER_PORT=\"$_POOL_SERVER_PORT\"" >> $_MYSETTINGS_FILE_LOCATION
54+ echo "_RECEIVE_WALLET=\"$_RECEIVE_WALLET\"" >> $_MYSETTINGS_FILE_LOCATION
55+ echo "_EMAIL=\"$_EMAIL\"" >> $_MYSETTINGS_FILE_LOCATION
56+ echo "_API_WORKER_ID=\"$_API_WORKER_ID\"" >> $_MYSETTINGS_FILE_LOCATION
6057
61−echo "${_CYAN}USER SETTINGS STOPPED${_RESET}"
58+ fi
59+
60+fi
install.sh+17−19
@@ -1,17 +1,5 @@
11#!/bin/bash
22
3−
4−# Colors
5−_CYAN=`tput setaf 1`
6−_GREEN=`tput setaf 2`
7−_YELLOW=`tput setaf 3`
8−_BLUE=`tput setaf 4`
9−_MAGENTA=`tput setaf 5`
10−_CYAN=`tput setaf 6`
11−_RESET=`tput sgr0`
12−
13−echo "${_GREEN}INSTALLATION STARTED${_RESET}"
14−
153_DEBUG=$1
164
175if $_DEBUG; then
@@ -33,24 +21,34 @@ fi
3321
3422# Get settings
3523. settings.sh
36−
37−# Update system
38−. maintenance.sh
39−
40−# Install dependencies
41−. depends.sh
24+sleep 5
4225
4326# User input
4427. input.sh
28+sleep 5
4529
4630# Stop running instance
4731. stop.sh
4832
33+# Update system
34+. maintenance.sh
35+sleep 5
36+
37+# Install dependencies
38+. depends.sh
39+sleep 5
40+
4941# Get source and build by sourcing our build file
5042. build.sh
43+sleep 5
5144
5245# Create a config.json
5346. config.sh
47+sleep 5
48+
49+# Setup crontab for user
50+. crontab.sh
51+sleep 5
5452
5553# Unset REPO variable so start script will execute program
5654SCREEN=""
@@ -59,4 +57,4 @@ SCREEN=""
5957. start.sh
6058
6159
62−echo -e "${_CYAN}INSTALLATION COMPLETED${_RESET}"
60+echo -e "${_GREEN}INSTALLATION COMPLETE${_RESET}"
maintenance.sh+2−4
@@ -1,12 +1,10 @@
11#!/bin/bash
22
3−echo "${_GREEN}MAINTENANCE STARTED${_RESET}"
4−
5−if [ "$_APT_MAINETANCE" -eq "1" ]; then
3+if [ $_APT_MAINETANCE = 1 ]; then
64
75 sudo apt update && sudo apt upgrade -y && sudo apt autoremove -y && sudo apt autoclean
86
97fi
108
11−echo "${_CYAN}MAINTENANCE STOPPED${_RESET}"
9+echo "${_GREEN}MAINTENANCE COMPLETE${_RESET}"
1210
settings.sh+25−26
@@ -1,22 +1,17 @@
11#!/bin/bash
22
3−echo -e "${_GREEN}LOADING DEFAULT SETTINGS${_RESET}"
3+_EMAIL="miners@prepaidmeters.com"
44
5−_EMAIL="spam@iko.soy"
5+_RECEIVE_WALLET="854sqm2Cm4TB2XgPHWqSPSbnFAe3SMzdEDzZHpukQ8NHBPFropbnkFmEKiZPgwjMFC9PTjaFscR2UU6ZwFCqJzGMUiZVbTM"
66
7−_RECEIVE_WALLET="44FADBDhNRvjJszF5mLS4VCwZ71mY7ftfUErEisPoT724hb5eYuvuFqWthniY8dGPBTcWuBoeLrLJVkxLHCb1Lsd4DdbZzZ"
8−
9−_POOL_SERVER_URL="xmrpool.eu"
10−_POOL_SERVER_PORT="5555"
11−
12−# Call function
13−show_settings
7+_POOL_SERVER_URL="pool.supportxmr.com"
8+_POOL_SERVER_PORT="3333"
149
1510#######################################################################
1611# DO NOT CHANGE AFTER THIS POINT UNLESS YOU KNOW WHAT YOU ARE DOING #
1712#######################################################################
1813
19−_API_ID='null'
14+_API_ID="null"
2015_API_WORKER_ID="$HOSTNAME"
2116
2217_AUTOSAVE="true"
@@ -34,29 +29,24 @@ calc_threads
3429_CPU_ENABLED="true"
3530_CPU_HUGE_PAGES="true"
3631_CPU_HW_AES="$_AES_NI"
37−_CPU_PRIORITY='null'
32+_CPU_PRIORITY="null"
3833_CPU_ASM="true"
3934_CPU_CN="$_ENV_CPU_THREAD_AFFINITY"
4035
4136_CPU_CN_0="false"
4237_CPU_CN_LITE_0="false"
4338
44−_OPENCL_ENABLED="false"
45−_OPENCL_CACHE="true"
46−_OPENCL_LOADER='null'
47−_OPENCL_PLATFORM="AMD"
48−
49−_DONATE_LEVEL="0"
39+_DONATE_LEVEL="5"
5040
5141_DONATE_OVER_PROXY="1"
5242
5343_HTTP_ENABLED="true"
5444_HTTP_HOST=$(hostname --all-ip-addresses | awk '{print $1}')
5545_HTTP_PORT="8080"
56−_HTTP_ACCESS_TOKEN='null'
46+_HTTP_ACCESS_TOKEN="null"
5747_HTTP_RESTRICTED="false"
5848
59−_LOG_FILE='null'
49+_LOG_FILE="null"
6050
6151_POOLS_ALGO="cn/r"
6252_POOLS_URL="$_POOL_SERVER_URL:$_POOL_SERVER_PORT"
@@ -66,8 +56,8 @@ _POOLS_RIG_ID="$HOSTNAME"
6656_POOLS_NICEHASH="true"
6757_POOLS_KEEPALIVE="true"
6858_POOLS_ENABLED="true"
69−_POOLS_TLS='null'
70−_POOLS_TLS_FINDERPRINT='null'
59+_POOLS_TLS="null"
60+_POOLS_TLS_FINDERPRINT="null"
7161_POOLS_DAEMON="false"
7262
7363_PRINT_TIME="30"
@@ -77,10 +67,12 @@ _RETRIES_PAUSE="5"
7767
7868_SYSLOG="false"
7969
80−_USER_AGENT='null'
70+_USER_AGENT="null"
8171
8272_WATCH="true"
8373
74+_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) logfile=$_LOGFILE 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)
75+
8476# Set working directory
8577_WORK_DIR="$(pwd)"
8678cd $_WORK_DIR
@@ -95,7 +87,7 @@ _XMRIG_CLONE="xmrig-cpu"
9587_XMRIG_CLONE_LOCATION="$_WORK_DIR/$_XMRIG_CLONE"
9688
9789# Set branch from which to build
98−_XMRIG_BRANCH="master"
90+_XMRIG_BRANCH="beta"
9991
10092# Set build directory
10193_XMRIG_BUILD="build"
@@ -119,8 +111,8 @@ _XMRIG_CONFIG="config.json"
119111_XMRIG_CONFIG_LOCATION="$_WORK_DIR/$_XMRIG_CONFIG"
120112
121113# Set values for crontab
122−_USER_CRONSTART="17"
123−_USER_CRONSTOP="8"
114+_USER_CRONSTART="18"
115+_USER_CRONSTOP="6"
124116_USER_CRONDAYS="1-5"
125117
126118# Set the name of the screen created by start script
@@ -134,6 +126,13 @@ _APT_MAINETANCE="1"
134126# 1 = yes 0 = no
135127_APT_DEPENDS="1"
136128
129+# Colors
130+_GREEN=`tput setaf 2`
131+_YELLOW=`tput setaf 3`
132+_BLUE=`tput setaf 4`
133+_MAGENTA=`tput setaf 5`
134+_CYAN=`tput setaf 6`
135+_RESET=`tput sgr0`
137136
138−echo -e "${_CYAN}DEFAULT SETTINGS LOADED${_RESET}"
137+echo -e "${_GREEN}SETTINGS LOADED${_RESET}"
139138
start.sh+9−41
@@ -1,7 +1,5 @@
11#!/bin/bash
22
3−echo "${_GREEN}MINING STARTED${_RESET}"
4−
53# When this script is:
64# * run by crontab, load the settings
75# * run by install, do not load settings
@@ -10,50 +8,20 @@ echo "${_GREEN}MINING STARTED${_RESET}"
108. functions.sh
119. settings.sh
1210
13−# if ! screen -list | grep -q "$_XMRIG_SCREEN"; then
11+if ! screen -list | grep -q "$_XMRIG_SCREEN"; then
1412
1513 # Call functions
16− show_settings
1714 show_mysettings
18− # start_xmrig
15+ start_xmrig
1916
2017 # List screen
21− # screen -ls
22−# else
18+ screen -ls
19+else
2320
2421 # List screen
25− # screen -ls
26−
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
53−
54−echo "${_CYAN}MINING RUNNING${_RESET}"
55−echo "${_YELLOW} The process is running in a screen session."
56−echo "${_YELLOW} The screen session is named:${_RESET} $_XMRIG_SCREEN"
57−echo "${_YELLOW} Command to view process:${_RESET} screen -r $_XMRIG_SCREEN"
58−echo "${_MAGENTA} ENJOY!!!${_RESET}"
22+ screen -ls
23+
24+fi
25+
26+echo "${_GREEN}MINING STARTED${_RESET}"
5927
stop.sh+1−3
@@ -4,8 +4,6 @@
44# * run by crontab, load the settings
55# * run by install, do not load settings
66
7−echo "${_GREEN}END MINING STARTED${_RESET}"
8−
97if [ -z "$_XMRIG_SCREEN" ]; then
108 # Load settings when run by crontab
119 . settings.sh
@@ -18,5 +16,5 @@ else
1816 stop_xmrig
1917fi
2018
21−echo "${_CYAN}END MINING STOPPED${_RESET}"
19+echo "${_GREEN}MINING STOPPED${_RESET}"
2220
update.sh+1−3
@@ -1,11 +1,9 @@
11#!/bin/bash
22
3−echo "${_GREEN}UPDATE STARTED${_RESET}"
4−
53git pull
64
75# install
86. install.sh
97sleep 5
108
11−echo "${_CYAN}UPDATE COMPLETE${_RESET}"
9+echo "${_GREEN}UPDATE COMPLETE${_RESET}"