mirror of
https://github.com/ilyakooo0/xmrig-bash-scripts.git
synced 2024-11-25 20:08:24 +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
|
||||
|
||||
# Setup users contab
|
||||
echo "Creating new crontab"
|
||||
|
||||
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
|
||||
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 " CRONTAB UPDATED"
|
||||
|
@ -1,3 +1,5 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
build_xmrig () {
|
||||
if [ -d $_XMRIG_BUILD_LOCATION ]; then
|
||||
# Remove existing build directory
|
||||
|
@ -1,5 +1,14 @@
|
||||
#!/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
|
||||
. settings.sh
|
||||
. functions.sh
|
||||
|
13
settings.sh
13
settings.sh
@ -1,4 +1,4 @@
|
||||
#!/bin/bash
|
||||
#!/usr/bin/env bash
|
||||
|
||||
echo "#################################"
|
||||
echo " LOADING SETTINGS "
|
||||
@ -70,17 +70,6 @@ echo -e "Cron on days: $_USER_CRONDAYS\n"
|
||||
_XMRIG_SCREEN="xmrig-cpu"
|
||||
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
|
||||
cpuid | grep -i aes > hw-aes.txt
|
||||
if grep -q true "hw-aes.txt"; then
|
||||
|
25
start.sh
25
start.sh
@ -1,4 +1,4 @@
|
||||
#!/bin/bash
|
||||
#!/usr/bin/env bash
|
||||
|
||||
# When this script is:
|
||||
# * run by crontab, load the settings
|
||||
@ -7,29 +7,24 @@
|
||||
echo "####################################"
|
||||
echo " STARTING "
|
||||
echo "####################################"
|
||||
|
||||
if [ -z "$_XMRIG_SCREEN" ]; then
|
||||
# Load settings when run by crontab
|
||||
# Also ensures vm.nr_hugepages is set
|
||||
. settings.sh
|
||||
. functions.sh
|
||||
|
||||
# Check another instance is not already running
|
||||
if ! screen -list | grep -q "$_XMRIG_SCREEN"; then
|
||||
# Call function
|
||||
echo "No screen sessionfound. Starting new screen session."
|
||||
start_xmrig
|
||||
fi
|
||||
else
|
||||
# Call function
|
||||
start_xmrig
|
||||
|
||||
# Unset _XMRIG_SCREEN variable.
|
||||
# The start script will have to load settings on next start
|
||||
$_XMRIG_SCREEN=""
|
||||
fi
|
||||
|
||||
# List screen
|
||||
screen -ls
|
||||
else
|
||||
# Call function
|
||||
echo "Found existing screen session. Leaving."
|
||||
|
||||
# List screen
|
||||
screen -ls
|
||||
|
||||
fi
|
||||
|
||||
echo "####################################"
|
||||
echo " STARTED - use screen -r to view "
|
||||
|
Loading…
Reference in New Issue
Block a user