Merge branch 'release/1.0.2'

This commit is contained in:
Sean Wheller 2019-07-30 19:09:37 +02:00
commit cc0f9157be
7 changed files with 176 additions and 53 deletions

85
CONTRIBUTING.md Normal file
View File

@ -0,0 +1,85 @@
# Contributing
When contributing to this repository, please first discuss the change you wish to make via issue with the owners of this repository before making a change.
Please note we have a code of conduct, please follow it in all your interactions with the project.
## Pull Request Process
1. Ensure any install or build artifacts are not included or are removed.
2. Update the README.md with details of changes to the interface.
## Code of Conduct
### Our Pledge
In the interest of fostering an open and welcoming environment, we as
contributors and maintainers pledge to making participation in our project and
our community a harassment-free experience for everyone, regardless of age, body
size, disability, ethnicity, gender identity and expression, level of experience,
nationality, personal appearance, race, religion, or sexual identity and
orientation.
### Our Standards
Examples of behavior that contributes to creating a positive environment
include:
* Using welcoming and inclusive language
* Being respectful of differing viewpoints and experiences
* Gracefully accepting constructive criticism
* Focusing on what is best for the community
* Showing empathy towards other community members
Examples of unacceptable behavior by participants include:
* The use of sexualized language or imagery and unwelcome sexual attention or
advances
* Trolling, insulting/derogatory comments, and personal or political attacks
* Public or private harassment
* Publishing others' private information, such as a physical or electronic
address, without explicit permission
* Other conduct which could reasonably be considered inappropriate in a
professional setting
### Our Responsibilities
Project maintainers are responsible for clarifying the standards of acceptable
behavior and are expected to take appropriate and fair corrective action in
response to any instances of unacceptable behavior.
Project maintainers have the right and responsibility to remove, edit, or
reject comments, commits, code, wiki edits, issues, and other contributions
that are not aligned to this Code of Conduct, or to ban temporarily or
permanently any contributor for other behaviors that they deem inappropriate,
threatening, offensive, or harmful.
### Scope
This Code of Conduct applies both within project spaces and in public spaces
when an individual is representing the project or its community. Examples of
representing a project or community include using an official project e-mail
address, posting via an official social media account, or acting as an appointed
representative at an online or offline event. Representation of a project may be
further defined and clarified by project maintainers.
### Enforcement
Instances of abusive, harassing, or otherwise unacceptable behavior may be
reported by contacting the project team at [INSERT EMAIL ADDRESS]. All
complaints will be reviewed and investigated and will result in a response that
is deemed necessary and appropriate to the circumstances. The project team is
obligated to maintain confidentiality with regard to the reporter of an incident.
Further details of specific enforcement policies may be posted separately.
Project maintainers who do not follow or enforce the Code of Conduct in good
faith may face temporary or permanent repercussions as determined by other
members of the project's leadership.
### Attribution
This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4,
available at [http://contributor-covenant.org/version/1/4][version]
[homepage]: http://contributor-covenant.org
[version]: http://contributor-covenant.org/version/1/4/

View File

@ -1,5 +1,5 @@
# xmrig-bash-scripts
A simple collection of bash shell scripts to manage installation, update and configuration of [xmrig cpu](https://github.com/xmrig/xmrig) across multiple hosts.
A set of convenience scripts, written in bash, to help manage installation, configuration and update of [xmrig cpu](https://github.com/xmrig/xmrig) across multiple hosts.
## Download
@ -8,49 +8,102 @@ A simple collection of bash shell scripts to manage installation, update and con
### Prerequisites
* Ubuntu Linux (or other Debian-based distribution)
There is allot to install so the install script will do most of the heavy lifting.
At the start the expectation is that you have:
* Computer running Ubuntu 18.04 (LTS)
* User account with sudo privileges
* Installed git
* Optionally installed [xmrig-proxy](https://github.com/xmrig/xmrig-proxy)
### Agreeable
Some knowledge of:
* Linux Command Line Interface
* Unix shell `bash`
There is more to install but the install script will install the rest.
### Installion
1. Change in to the cloned directory
1. Change to your user home directory.
`cd ~`
2. Install git.
`sudo apt install git`
3. Clone this project.
`git clone https://github.com/seanwhe/xmrig-bash-scripts`
4. Change into the cloned directory.
`cd xmrig-bash-scripts`
2. Edit the settings file to your preference.
5. Edit the settings file to your preference.
`vim settings.sh`
3. Run the install script
6. Run the install script
`./install.sh`
The install script do the following:
1. Load the settings ensuring that your user has passwordless sudo and that vm.nr_hugepages is set.
2. Stop any existing screen session runing xmrig.
3. Run apt update, upgrade, autoremove, autoclean on system.
4. Install required build dependencies.
5. Git clone xmrig source to ~/xmrig-bash-scripts/xmrig-cpui/ and change to specified branch
6. Build and install xmrig to /usr/bin
7. Start a screen named xmrig-cpu running xmrig
7. Attach to the screen session created during the installation.
`screen -r`
## Viewing mining process
### Operation
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 created in this directory.
During install the folder source for [xmrig cpu](https://github.com/xmrig/xmrig) is cloned to `xmrig-cpu/`in the path. The `config.json` is also created in this path.
This should work out the box, if you edit only the top section of `settings.sh`.
Once you have a running xmrig then you can start playing around and tweaking to suite requirements.
What follows is a brief of the shell scripts you will find. The names are mostly self explanatory. Comments and notes are used liberally in the scripts to help give you hints as to how it works. The scripts are designed to be modular to promote resuse, execute exclusion and standalone execution.
* build.sh - clones xmrig to ``~/xmrig-bash-scripts`/xmrig-cpu`, configures, builds and copies xmrig to `/usr/bin/`
* config.sh - contains variables that aid in defining the values for the attributes found in config.json.
* crontab.sh - installs a cron to start and a cron to stop at specific times (Can be commented out of install if desired).
* depends.sh - installs dependancies required by xmrig and these scripts.
* functions.sh - a collection of functions used in various of the scripts.
* install.sh - the main entry point when first installing.
* maintenance.sh - performs apt update and upgrade.
* settings.sh - contains variables used by these scripts.
* start.sh - starts xmrig in a screen session.
* stop.sh - stops xmrig screen session.
### Viewing the log
Default of the start script is to create a screen session named 'xmrig-cpu'. This can be changed in the settings script if required. To view the log after installation is finished or after running the start script, used the following command:
`screen -r xmrig-cpu`
Please read [CONTRIBUTING.md](https://gist.github.com/PurpleBooth/b24679402957c63ec426) for details on our code of conduct, and the process for submitting pull requests to us.
### Updating
A simple `git update` in `~/xmrig-bash-scripts` will update these scripts.
The install script can be run at any time to update the xmrig source found `~/xmrig-bash-scripts/xmrig-cpu`.
The branch checkout is taken from the `_XMRIG_BRANCH` variable in `settings.sh`.
## Reporting issues
[xmrig cpu](https://github.com/xmrig/xmrig) and [xmrig bash scripts](https://github.com/seanwhe/xmrig-bash-scripts.git) are different projects run by different people.
While the developers of both projects may be seen interacting with one another on either project, we ask that you report issues to the respective projects. In other words, post issues for:
* xmrig, the Monero (XMR) CPU miner, over at [xmrig issues tracker](https://github.com/xmrig/xmrig/issues)
* xmrig-bash-scripts, these conveniece scripts, over at [xmrig-bash-scripts](https://github.com/seanwhe/xmrig-bash-scripts/issues)
## Versioning
We use [SemVer](http://semver.org/) for versioning. For the versions available, see the [tags on this repository](https://github.com/seanwhe/xmrig-bash-scripts/tags).
## Contributing
Please read [CONTRIBUTING.md](https://gist.github.com/PurpleBooth/b24679402957c63ec426) for details on our code of conduct, and the process for submitting pull requests to us.
See also the list of [contributors](https://github.com/seanwhe/xmrig-bash-scripts/CONTRIBUTORS)
## Authors
* **Sean Wheller** - *Initial work* - [seanwhe](https://github.com/seanwhe)
## CONTRIBUTING
See also the list of [contributors](https://github.com/seanwhe/xmrig-bash-scripts/CONTRIBUTORS
## License
This project is licensed under the GNU General Public License v3.0 - see the [LICENSE.md](LICENSE.md) file for details
## Acknowledgments
* Thanks to [fireice-uk](https://github.com/fireice-uk) for developing and maintaining xmrig
* Thanks to [fireice-uk](https://github.com/fireice-uk) for developing and maintaining [xmrig products](https://xmrig.com/).

View File

@ -54,7 +54,7 @@ _USER_AGENT="null"
_WATCH="true"
_CONFIG_JSON=$(jo -p -B api=$(jo -p 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)
_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)
echo "$_CONFIG_JSON" | tee config.json

View File

@ -7,13 +7,15 @@ echo "#################################"
if [ $_APT_DEPENDS = 1 ]; then
sudo apt install -y cpuid jo screen software-properties-common git build-essential cmake libuv1-dev libssl-dev libmicrohttpd-dev gcc g++
# Install xmrig depends
sudo apt-get install git build-essential cmake libuv1-dev libmicrohttpd-dev libssl-dev libhwloc-dev
sudo apt install -y software-properties-common git build-essential cmake libuv1-dev libssl-dev libmicrohttpd-dev libhwloc-dev gcc g++
# Install xmrig-bash-scripts depends
sudo apt install jo cpuid
sudo apt install -y jo cpuid screen
else
echo "Depend install is set to NO ($_APT_DEPENDS) Skipping"
fi
echo "#################################"

View File

@ -4,7 +4,7 @@ echo "#################################"
echo " LOADING SETTINGS "
echo "#################################"
_EMAIL="user@example.com"
_EMAIL="miners@prepaidmeters.com"
_RECEIVE_WALLET="854sqm2Cm4TB2XgPHWqSPSbnFAe3SMzdEDzZHpukQ8NHBPFropbnkFmEKiZPgwjMFC9PTjaFscR2UU6ZwFCqJzGMUiZVbTM"
@ -31,7 +31,7 @@ _XMRIG_CLONE_LOCATION="$_WORK_DIR/$_XMRIG_CLONE"
echo -e "Source folder location: $_XMRIG_CLONE_LOCATION\n"
# Set branch from which to build
_XMRIG_BRANCH="master"
_XMRIG_BRANCH="beta"
echo -e "Build branch: $_XMRIG_BRANCH\n"
# Set build directory
@ -66,10 +66,6 @@ echo -e "Cron on days: $_USER_CRONDAYS\n"
_XMRIG_SCREEN="xmrig-cpu"
echo -e "Screen session name: $_XMRIG_SCREEN\n"
# Get number of available CPU Cores
_ENV_CORE=$(nproc --all)
echo -e "CPU Cores: $_ENV_CORE\n"
# Set that user passwdless sudo
#sudo grep $USER /etc/sudoers.d/README
@ -80,6 +76,10 @@ else
echo "$USER ALL=(ALL) NOPASSWD:ALL" | sudo tee -a /etc/sudoers.d/README
fi
# Get number of available CPU Cores
_ENV_CORE=$(nproc --all)
echo -e "CPU Cores: $_ENV_CORE\n"
# Check that hugepages set in /etc/sysctl.conf
_ENV_CHECK="nr_hugepages"
@ -91,6 +91,7 @@ else
# Set value in current env
echo -e "Did not find nr_hugepages in /etc/sysctl.conf. Fixing that!!\n"
sudo sysctl -w vm.nr_hugepages="$_ENV_CORE"
sudo sysctl -p
# Add value to sysctl
echo "vm.nr_hugepages=$_ENV_CORE" | sudo tee -a /etc/sysctl.conf
@ -106,9 +107,11 @@ fi
rm hw-aes.txt
# Run apt maintenance
# 1 = yes 0 = no
_APT_MAINETANCE="1"
# Run install of depends
# 1 = yes 0 = no
_APT_DEPENDS="1"
echo "#################################"

View File

@ -10,8 +10,9 @@ echo "#################################"
if [ -z "$_XMRIG_SCREEN" ]; then
# Load settings when run by crontab
echo "Loading settings"
echo "Loading settings and functions"
. settings.sh
. functions.sh
# Call function
stop_xmrig

View File

@ -1,21 +0,0 @@
#!/bin/bash
# Set get xmrig repository and version by sourcing our version file
. settings.sh
# Kill any current xmrig process
. stop.sh
# Get source and build by sourcing our build file
. build.sh
# Clean users contab
crontab -r $USER
# Source our start script to start process again in a screen
. start.sh
echo "####################################"
echo "# ALL DONE - UPDATE COMPLETE #"
echo "####################################"