mirror of
https://github.com/seanwhe/xmrig-bash-scripts.git
synced 2024-11-24 06:07:34 +03:00
Enhance script
This commit is contained in:
parent
3cfa2d1cc7
commit
807931db23
0
CONTRIBUTORS
Normal file
0
CONTRIBUTORS
Normal file
55
README.md
55
README.md
@ -1,2 +1,55 @@
|
||||
# xmrig-bash-scripts
|
||||
Simple collection of bash shell scripts I use to manage xmrig cpu
|
||||
A simple collection of bash shell scripts to manage installation, update and configuration of [xmrig cpu](https://github.com/xmrig/xmrig) across multiple hosts.
|
||||
|
||||
|
||||
## Download
|
||||
* https://github.com/seanwhe/xmrig-bash-scripts
|
||||
* Git clone with `git clone https://github.com/seanwhe/xmrig-bash-scripts`
|
||||
|
||||
### Prerequisites
|
||||
|
||||
* Ubuntu Linux (or other Debian-based distribution)
|
||||
* User account with sudo privileges
|
||||
|
||||
### Installion
|
||||
|
||||
1. Change in to the cloned directory
|
||||
`cd xmrig-bash-scripts`
|
||||
|
||||
2. Edit the settings file to your preference.
|
||||
`vim settings.sh`
|
||||
|
||||
3. 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
|
||||
|
||||
## Viewing mining process
|
||||
`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.
|
||||
|
||||
## 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).
|
||||
|
||||
## Authors
|
||||
|
||||
* **Sean Wheller** - *Initial work* - [seanwhe](https://github.com/seanwhe)
|
||||
|
||||
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
|
||||
|
34
build.sh
34
build.sh
@ -1,43 +1,9 @@
|
||||
#!/bin/bash
|
||||
|
||||
build_xmrig () {
|
||||
if [ -d $_XMRIG_BUILD_LOCATION ]; then
|
||||
# Remove existing build directory
|
||||
echo "Found old build directory. Removing"
|
||||
rm -rf $_XMRIG_BUILD_LOCATION
|
||||
|
||||
# Make new build directory
|
||||
echo "Creating a build directory"
|
||||
mkdir $_XMRIG_BUILD_LOCATION
|
||||
else
|
||||
# Make new build directory
|
||||
echo "Creating a build directory"
|
||||
mkdir $_XMRIG_BUILD_LOCATION
|
||||
fi
|
||||
|
||||
# Change to build directory
|
||||
echo "Changing to build directory"
|
||||
cd $_XMRIG_BUILD_LOCATION
|
||||
|
||||
# Configure cmake scafolding
|
||||
echo "Configuring cmake scafolding"
|
||||
cmake .. -DCMAKE_C_COMPILER=gcc-7 -DCMAKE_CXX_COMPILER=g++-7
|
||||
|
||||
# Compile the software
|
||||
echo "Starting build"
|
||||
make
|
||||
}
|
||||
|
||||
echo "#################################"
|
||||
echo " BUILD STARTING"
|
||||
echo "#################################"
|
||||
|
||||
# Update system
|
||||
sudo apt update && sudo apt upgrade -y && sudo apt autoremove -y && sudo apt autoclean
|
||||
|
||||
# Install the software requirements
|
||||
sudo apt install -y screen software-properties-common git build-essential cmake libuv1-dev libssl-dev libmicrohttpd-dev gcc g++
|
||||
|
||||
# Clone source
|
||||
if [ -d "$_XMRIG_CLONE_LOCATION" ]; then
|
||||
echo "Clone already exists"
|
||||
|
18
depends.sh
Executable file
18
depends.sh
Executable file
@ -0,0 +1,18 @@
|
||||
#!/bin/bash
|
||||
echo "#################################"
|
||||
echo " INSTALLING DEPENDENCIES "
|
||||
echo "#################################"
|
||||
|
||||
# Install the software requirements
|
||||
|
||||
if [ $_APT_DEPENDS = 1 ]; then
|
||||
|
||||
sudo apt install -y screen software-properties-common git build-essential cmake libuv1-dev libssl-dev libmicrohttpd-dev gcc g++
|
||||
|
||||
else
|
||||
echo "Depend install is set to NO ($_APT_DEPENDS) Skipping"
|
||||
fi
|
||||
|
||||
echo "#################################"
|
||||
echo " DEPENDENCIES INSTALLED "
|
||||
echo "#################################"
|
37
functions.sh
Executable file
37
functions.sh
Executable file
@ -0,0 +1,37 @@
|
||||
build_xmrig () {
|
||||
if [ -d $_XMRIG_BUILD_LOCATION ]; then
|
||||
# Remove existing build directory
|
||||
echo "Found old build directory. Removing"
|
||||
rm -rf $_XMRIG_BUILD_LOCATION
|
||||
|
||||
# Make new build directory
|
||||
echo "Creating a build directory"
|
||||
mkdir $_XMRIG_BUILD_LOCATION
|
||||
else
|
||||
# Make new build directory
|
||||
echo "Creating a build directory"
|
||||
mkdir $_XMRIG_BUILD_LOCATION
|
||||
fi
|
||||
|
||||
# Change to build directory
|
||||
echo "Changing to build directory"
|
||||
cd $_XMRIG_BUILD_LOCATION
|
||||
|
||||
# Configure cmake scafolding
|
||||
echo "Configuring cmake scafolding"
|
||||
cmake .. -DCMAKE_C_COMPILER=gcc-7 -DCMAKE_CXX_COMPILER=g++-7
|
||||
|
||||
# Compile the software
|
||||
echo "Starting build"
|
||||
make
|
||||
}
|
||||
|
||||
|
||||
start_xmrig () {
|
||||
screen -dmS $_XMRIG_SCREEN xmrig --config=$_XMRIG_CONFIG_LOCATION
|
||||
}
|
||||
|
||||
|
||||
stop_xmrig () {
|
||||
screen -S $_XMRIG_SCREEN -X kill
|
||||
}
|
@ -2,11 +2,20 @@
|
||||
|
||||
# Get settings
|
||||
. settings.sh
|
||||
. functions.sh
|
||||
sleep 5
|
||||
|
||||
# Stop running instance
|
||||
. stop.sh
|
||||
|
||||
# Update system
|
||||
. maintenance.sh
|
||||
sleep 5
|
||||
|
||||
# Install dependencies
|
||||
. depends.sh
|
||||
sleep 5
|
||||
|
||||
# Get source and build by sourcing our build file
|
||||
. build.sh
|
||||
sleep 5
|
||||
|
18
maintenance.sh
Executable file
18
maintenance.sh
Executable file
@ -0,0 +1,18 @@
|
||||
#!/bin/bash
|
||||
|
||||
echo "####################################"
|
||||
echo "# STARTING SYSTEM MAINTENANCE #"
|
||||
echo "####################################"
|
||||
|
||||
if [ $_APT_MAINETANCE = 1 ]; then
|
||||
|
||||
sudo apt update && sudo apt upgrade -y && sudo apt autoremove -y && sudo apt autoclean
|
||||
|
||||
else
|
||||
echo "Apt maintenance is set to NO ($_APT_MAINETANCE) Skipping"
|
||||
fi
|
||||
|
||||
echo "####################################"
|
||||
echo "# SYSTEM MAINTENANCE COMPLETE #"
|
||||
echo "####################################"
|
||||
|
@ -87,6 +87,12 @@ else
|
||||
echo "vm.nr_hugepages=$_ENV_CORE" | sudo tee -a /etc/sysctl.conf
|
||||
fi
|
||||
|
||||
# Run apt maintenance
|
||||
_APT_MAINETANCE="0"
|
||||
|
||||
# Run install of depends
|
||||
_APT_DEPENDS="0"
|
||||
|
||||
echo "#################################"
|
||||
echo " SETTINGS LOADED"
|
||||
echo "#################################"
|
||||
|
4
start.sh
4
start.sh
@ -4,10 +4,6 @@
|
||||
# * run by crontab, load the settings
|
||||
# * run by install, do not load settings
|
||||
|
||||
start_xmrig () {
|
||||
screen -dmS $_XMRIG_SCREEN xmrig --config=$_XMRIG_CONFIG_LOCATION
|
||||
}
|
||||
|
||||
echo "####################################"
|
||||
echo " STARTING "
|
||||
echo "####################################"
|
||||
|
Loading…
Reference in New Issue
Block a user