mirror of
https://github.com/ilyakooo0/xmrig-bash-scripts.git
synced 2024-11-29 09:06:52 +03:00
Merge branch 'release/1.0.4'
This commit is contained in:
commit
4e8aa2ef8a
@ -15,13 +15,14 @@ echo "Removing exiting crontab"
|
|||||||
crontab -r
|
crontab -r
|
||||||
|
|
||||||
# Setup users contab
|
# Setup users contab
|
||||||
|
echo "Creating new crontab"
|
||||||
|
|
||||||
crontab -l | { cat; echo "#Start at $_USER_TIMESTART on days $_USER_CRONDAYS
|
crontab -l | { cat; echo "#Start at $_USER_TIMESTART on days $_USER_CRONDAYS
|
||||||
0 $_USER_CRONSTART * * $_USER_CRONDAYS $_WORK_DIR/start.sh"; } | crontab -
|
0 $_USER_CRONSTART * * $_USER_CRONDAYS screen -dmS $_XMRIG_SCREEN xmrig --config=$_XMRIG_CONFIG_LOCATION"; } | crontab -
|
||||||
|
|
||||||
crontab -l | { cat; echo "#Stop at $_USER_TIMESTOP on days $_USER_CRONDAYS
|
crontab -l | { cat; echo "#Stop at $_USER_TIMESTOP on days $_USER_CRONDAYS
|
||||||
0 $_USER_CRONSTOP * * $_USER_CRONDAYS $_WORK_DIR/stop.sh"; } | crontab -
|
0 $_USER_CRONSTOP * * $_USER_CRONDAYS screen -S $_XMRIG_SCREEN -X kill"; } | crontab -
|
||||||
|
|
||||||
crontab -l
|
|
||||||
|
|
||||||
echo "#################################"
|
echo "#################################"
|
||||||
echo " CRONTAB UPDATED"
|
echo " CRONTAB UPDATED"
|
||||||
|
@ -1,3 +1,5 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
build_xmrig () {
|
build_xmrig () {
|
||||||
if [ -d $_XMRIG_BUILD_LOCATION ]; then
|
if [ -d $_XMRIG_BUILD_LOCATION ]; then
|
||||||
# Remove existing build directory
|
# Remove existing build directory
|
||||||
|
@ -1,5 +1,14 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
|
# Set that user passwdless sudo
|
||||||
|
|
||||||
|
if sudo grep -q $USER /etc/sudoers.d/README; then
|
||||||
|
echo -e "User $USER found in /etc/sudoers.d/README. All good!!\n"
|
||||||
|
else
|
||||||
|
echo -e "$USER does not have passwdles sudo. Fixing that!!\n"
|
||||||
|
echo "$USER ALL=(ALL) NOPASSWD:ALL" | sudo tee -a /etc/sudoers.d/README
|
||||||
|
fi
|
||||||
|
|
||||||
# Get settings
|
# Get settings
|
||||||
. settings.sh
|
. settings.sh
|
||||||
. functions.sh
|
. functions.sh
|
||||||
|
13
settings.sh
13
settings.sh
@ -1,4 +1,4 @@
|
|||||||
#!/bin/bash
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
echo "#################################"
|
echo "#################################"
|
||||||
echo " LOADING SETTINGS "
|
echo " LOADING SETTINGS "
|
||||||
@ -70,17 +70,6 @@ echo -e "Cron on days: $_USER_CRONDAYS\n"
|
|||||||
_XMRIG_SCREEN="xmrig-cpu"
|
_XMRIG_SCREEN="xmrig-cpu"
|
||||||
echo -e "Screen session name: $_XMRIG_SCREEN\n"
|
echo -e "Screen session name: $_XMRIG_SCREEN\n"
|
||||||
|
|
||||||
# Set that user passwdless sudo
|
|
||||||
#sudo grep $USER /etc/sudoers.d/README
|
|
||||||
|
|
||||||
if sudo grep -q $USER /etc/sudoers.d/README; then
|
|
||||||
echo -e "User $USER found in /etc/sudoers.d/README. All good!!\n"
|
|
||||||
else
|
|
||||||
echo -e "$USER does not have passwdles sudo. Fixing that!!\n"
|
|
||||||
echo "$USER ALL=(ALL) NOPASSWD:ALL" | sudo tee -a /etc/sudoers.d/README
|
|
||||||
fi
|
|
||||||
|
|
||||||
|
|
||||||
# Check if CPU supports AES-NI
|
# Check if CPU supports AES-NI
|
||||||
cpuid | grep -i aes > hw-aes.txt
|
cpuid | grep -i aes > hw-aes.txt
|
||||||
if grep -q true "hw-aes.txt"; then
|
if grep -q true "hw-aes.txt"; then
|
||||||
|
35
start.sh
35
start.sh
@ -1,4 +1,4 @@
|
|||||||
#!/bin/bash
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
# When this script is:
|
# When this script is:
|
||||||
# * run by crontab, load the settings
|
# * run by crontab, load the settings
|
||||||
@ -7,29 +7,24 @@
|
|||||||
echo "####################################"
|
echo "####################################"
|
||||||
echo " STARTING "
|
echo " STARTING "
|
||||||
echo "####################################"
|
echo "####################################"
|
||||||
|
. settings.sh
|
||||||
|
. functions.sh
|
||||||
|
|
||||||
if [ -z "$_XMRIG_SCREEN" ]; then
|
if ! screen -list | grep -q "$_XMRIG_SCREEN"; then
|
||||||
# Load settings when run by crontab
|
# Call function
|
||||||
# Also ensures vm.nr_hugepages is set
|
echo "No screen sessionfound. Starting new screen session."
|
||||||
. settings.sh
|
|
||||||
. functions.sh
|
|
||||||
|
|
||||||
# Check another instance is not already running
|
|
||||||
if ! screen -list | grep -q "$_XMRIG_SCREEN"; then
|
|
||||||
# Call function
|
|
||||||
start_xmrig
|
|
||||||
fi
|
|
||||||
else
|
|
||||||
# Call function
|
|
||||||
start_xmrig
|
start_xmrig
|
||||||
|
|
||||||
# Unset _XMRIG_SCREEN variable.
|
# List screen
|
||||||
# The start script will have to load settings on next start
|
screen -ls
|
||||||
$_XMRIG_SCREEN=""
|
else
|
||||||
fi
|
# Call function
|
||||||
|
echo "Found existing screen session. Leaving."
|
||||||
|
|
||||||
# List screen
|
# List screen
|
||||||
screen -ls
|
screen -ls
|
||||||
|
|
||||||
|
fi
|
||||||
|
|
||||||
echo "####################################"
|
echo "####################################"
|
||||||
echo " STARTED - use screen -r to view "
|
echo " STARTED - use screen -r to view "
|
||||||
|
Loading…
Reference in New Issue
Block a user